#define FALSE -1
#define TRUE 1
#define NULL 0
main() {
if(NULL)
puts("NULL");
else if(FALSE)
puts("TRUE");
else
puts("FALSE");
}
Answer / susie
Answer :
TRUE
Explanation:
The input program to the compiler after processing by the
preprocessor is,
main(){
if(0)
puts("NULL");
else if(-1)
puts("TRUE");
else
puts("FALSE");
}
Preprocessor doesn't replace the values given inside the
double quotes. The check by if condition is boolean value
false so it goes to else. In second if -1 is boolean value
true hence "TRUE" is printed.
| Is This Answer Correct ? | 12 Yes | 4 No |
Write a routine that prints out a 2-D array in spiral order
main() { unsigned char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }
main() { char a[4]="HELLO"; printf("%s",a); }
main() { int i=5; printf("%d",++i++); }
main() { int i, n; char *x = “girl”; n = strlen(x); *x = x[n]; for(i=0; i<n; ++i) { printf(“%s\n”,x); x++; } }
Write a C function to search a number in the given list of numbers. donot use printf and scanf
What is wrong with the following code? int *foo() { int *s = malloc(sizeof(int)100); assert(s != NULL); return s; }
why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?
Question: We would like to design and implement a programming solution to the reader-writer problem using semaphores in C language under UNIX. We assume that we have three readers and two writers processes that would run concurrently. A writer is to update (write) into one memory location (let’s say a variable of type integer named temp initialized to 0). In the other hand, a reader is to read the content of temp and display its content on the screen in a formatted output. One writer can access the shared data exclusively without the presence of other writer or any reader, whereas, a reader may access the shared memory for reading with the presence of other readers (but not writers).
C statement to copy a string without using loop and library function..
#if something == 0 int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }