Is it possible to execute a "C" statement without a semicolon
Post an example to execute a "C" statement without semicolon( ; ) ...
Post an example to execute a "C" statement without semicolon( ; ) ...
I am compiling this piece of code and I get compliation errors saying " dereferencing pointer to incomplete type" . I get the errors for the last print statement and before that where I try to point (*temp). num to the address of b Here's the code snippet: void main() { struct { int xx; char *y; int * nu...
Are there some good ways to know how a function performs in C? I would like to, for example compare my own function to a library function. ...
I have a question about the following C code: void my_function() { int i1; int j1; // Do something... if (check_something()) { int i2; int j2; // Do something else... } // Do some more stuff... } Are there any guarantees about when stack space is allocated/deallocated for i2 and ...
If possible, how can I improve the following quick sort(performance wise).Any suggestions? void main() { quick(a,0,n-1); } void quick(int a[],int lower,int upper) { int loc; if(lower<upper) { loc=partition(a,lower,upper); quick(a,lower,loc-1); quick(a,loc+1,upper)...
Why the function name main() is retained in many languages like C, C++, Java? Why not any other names for that function? Is there any common structure for all these 3 main() (in C, C++, Java) ...
Possible Duplicate: Get MX record via C program. Is there any function in C on linux by which we can query MX record (like gethostbyname).? ...
I'm sure there are sometimes good reasons for taking the sizeof() a #define in C, but I occasionally come across bugs where someone has taken the sizeof() a #define instead of the sizeof() a structure (and in my codebase I don't need to take the sizeof() a #define). For example (contrived, but hopefully illustrates the point): typedef ...
How do I initialize a 2D array with 0s when I declare it? double myArray[3][12] = ? ...
I'm following the kernel tutorial from here im having problems compiling my files. i get the following errors when i try to compile: main.c:8: error: expected declaration specifiers or ‘...’ before ‘size_t’ main.c:8: error: conflicting types for ‘memcpy’ ./include/system.h:5: note: previous declaration of ‘me...
I have installed BIND. I am using -lresolv as paramete while compiling in gcc. But it is giving error: /usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crt1.o: In function `_start': (.text+0x18): undefined reference to `main' /tmp/cck9LhAK.o: In function `resolvmx': res.c:(.text+0x6b): undefined reference to `__ns_initparse' res.c:(.text+0...
Here the code #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <netinet/in.h> #include <resolv.h> int main (int argc, char *argv[]) { u_char nsbuf[4096]; char dispbuf[4096]; ns_msg msg; ns_rr rr; int i, j, l; if (argc < 2) { printf ("Usage: %s <domain>[...]\n", argv[0]); exit ...
Hi guys, I'm trying to use C stdarg.h lib, with a generic type. The type int, is my generic type > to understand it, please, hold reading. So, my problem is: I have a function that accept variable number of arguments. like void function (int paramN, ...); In my program, there are no way to know, which is the type of variable arguments...
Can you point me to some online resources? I couldn't find any good. Also the resources shouldnt be too old. There also wasn't any SO question covering this. Or atleast I didn't find it. Edit: Practical approaches would be very nice too. Something like Real World Haskell but just for C. Is there something like this? Edit2: With "too ...
in c, i tried to print out address of variable and address of some function. I got one is negative value, the other is positive value. My question is: why does C not represent in all negative or all positive value? Here is my code: int foo() { return 0; } int main() { int a; printf("%d\n",&a); printf("%d\n",foo); ...
I have a macro for a character string as follows: #define APPNAME "MyApp" Now I want to construct a wide string using this macro by doing something like: const wchar_t *AppProgID = APPNAME L".Document"; However, this generates a "concatenating mismatched strings" compilation error. Is there a way to convert the APPNAME macro to a ...
I am trying to find the max number in an array. I have created a function and I am using the following code: int maxValue( int myArray [], int size) { int i, maxValue; maxValue=myArray[0]; //find the largest no for (i=0;i) { if (myArray[i]>maxValue) maxValue=myArray[i]; } return maxValue; } H...
If I have an array and I need to display how many times the number '12' is created. I'm using a function to go about this. What resources should I look into to find how to exactly tease out this one number and display how many times it is in the array/list? Any help would be greatly appreciated. ...
Hi, does this code char *a() { char *t = malloc(8); t[0] = 'a'; t[1] = 'b'; ... t[7] = 'h'; return t; } int main(void) { char *x = a(); //do something with x ..... free(x); return 0; } have any potential problems since I allocate memory in a() and use that memory in main()?? Thanks. ...
Hi, I have a simple code char t = (char)(3000); Then value of t is -72. The hex value of 3000 is 0xBB8. I couldn't understand why the value of t is -72. Thanks for your answers. ...