static char a[255] = "\0";
and
const char *b = " ";
now when I assign "abc" to a and b, for a the remainig 252 bytes stay '\0' and for b its not like that. So, when I try to compare them, they come out to be different.
One solution is to just compare till sizeof(b) as we do in strncmp().
Is there any other way of doing it? Probably b...
is it possible to calculate a ratio using a function in C?? or do i have to do up a formula??
...
Is there a reporting tool in C? like jasper report in java.
...
Hi all..
I need a C/C++ source code editor (for Linux) which has Source Insight's features, such as:
Context window : when our cursor is above variable/class/function, the context window will display the declaration of that variable/class or the implementation body of that function
Ctrl+Click at any variable/class/function, it will ju...
HI
I am a B.E(CS) fresher.I am searching for a job in IT.There are openings for few C++
developers than java developers.Once i get 1-2 years of experience as C++ developer,can
i switch to a java application developer(for survival).
...
I wrote a code to get a runtime error intentionally:
int main()
{
int a=5;
printf("Hello World\n");
printf("a=%s\n", a);
}
It gives:
$ ./error.o
Hello World
Segmentation Fault
$
Now, to record the runtime errors, I do:
$ ./error.o > so.txt
$ ./error.o &> soe.txt
But both the files are empty. Why?
EDIT:
I'm actually writing ...
How do I programmatically open a file in its default program (I'm using Windows XP).
For example, opening *.txt will open the file in notepad.
...
I have an application that consists of multiple python scripts. Some of these scripts are calling C code. The application is now running much slower than it was, so I would like to profile it to see where the problem lies. Is there a tool, software package or just a way to profile such an application? A tool that will follow the python c...
I have two big numbers (type int) which are stored in array with a size at least 1000,
and I want to compare these two numbers to get information which one is bigger than the other. How can I do this?
Actually , I will do two things
subtract these two
multiply these two (I am studying in this topic, indeed, and I didn't find an effi...
Do these two lines of code achieve the same result? If I had these lines in a function, is the string stored on the stack in both cases? Is there a strong reason why I should use one over the other, aside from not needing to declare the null terminator in the first line of code?
char s[] = "string";
char* s = "string\0";
...
Multiplication of two integers, like
a = 38473847837483473894283749832938293872389472847389243847347
b = 92892382019283923829302392830923890
stored as
a[0] = 3, a[1] = 8 ...
I want to multiply these two over using efficient algorithm (note I stored them in array A and array B). And I want store result in RES[].
How can I do, ...
Hello all!
I'm new to objective-C. I want to use NSMutableArray to store some objects i will access later.
I've got the interface:
@interface ControlWheel : RotatableObject <LeverSubject>
{
NSMutableArray *subjectArray_;
}
-(id) initWithCWDef: (ControlWheelDef*) def;
-(void) addSubject: (id) subject;
@end
Here is the implementation...
Hi,
While working with pointers in C, I have been experiencing a very incosistent result, I am working with a token which is a byte string which i need to make a directory path.
a token consists of the date as a prefix in the format of 20101129(2010-oct-29) and then a 20byte string follows, thus a token would look like 20101102A2D8B328CX...
#include <stdio.h>
#include <stdlib.h>
int main()
{
int *numeros = malloc(sizeof(int) * 3 * 3);
numeros[900] = 10;
printf("%d", numeros[900]);
free(numeros);
return 0;
}
Why exactly this prints out 10 when I haven't allocated enough memory?
I'm pretty sure I'm missing something big on pointers/etc.
Thanks for help...
Rendering contexts usually have a solid color on the background (black or whatever, see the image below):
I'm wondering if it's possible to setup a window, with no decorations AND with the transparent background, while allowing me to render OpenGL stuff on it.
This would give the illusion that the triangle is floating on the screen. ...
I have this code from my professor and it's about finding abundant and defective numbers. A number x is effective if the sum of all integer divisors, except for x itself, is less than x. If it's greater than x, then it's abundant.
There are no compile errors and it seems all fine, but it just doesn't print anything, it doesn't get any r...
Hello.
I made a structure like so:
struct ponto {
int x;
int y;
int z;
};
1) Can I initialize the int's with a default value? int var = value; doesn't seem to work, compiler says "syntax error before '=' token" or something of sorts.
2) I need to work with several of these like in a array of structures, but I only know ho...
So Im making a Load.c file, that basically will load a bunch of "students" into shared memory.
The students are stored in a struct that looks like this:
struct StudentInfo{
char fName[20];
char lName[20];
char telNumber[15];
char whoModified[10];
};
Anyways I need to load this in shared memory, we were given some sample code. and we a...
I am trying to write a program on an embedded system running GUMSTIX(Linux) to connect and talk to an Android 2.x device over bluetooth. The GUMSTIX is the client and the Android is the server. I am trying to find the channel number that my Android service uses so that the GUMSTIX can connect to it but for some reason my routine isn't ...
Possible Duplicate:
Where can I find C coding exercises to practice?
hello everyone!
i am a C language learner!
what i want to ask here is that from where can i get some programming questions to test my real skill and to find out the areas where i still need to work!
i know that i need to learn alot more but i wont get the ri...