char *someFun()
{
char *temp = “string constant";
return temp;
}
int main()
{
puts(someFun());
}
Answer / susie
Answer :
string constant
Explanation:
The program suffers no problem and gives the output
correctly because the character constants are stored in
code/data area and not allocated in stack, so this doesn’t
lead to dangling pointers.
| Is This Answer Correct ? | 4 Yes | 0 No |
main() { main(); }
main() { char name[10],s[12]; scanf(" \"%[^\"]\"",s); } How scanf will execute?
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 ?
main() { int c=- -2; printf("c=%d",c); }
Give a oneline C expression to test whether a number is a power of 2?
25 Answers EA Electronic Arts, Google, Motorola,
Given an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like.
21 Answers ABC, eBay, Goldman Sachs, Google, HUP, Microsoft, TATA,
main ( ) { static char *s[ ] = {“black”, “white”, “yellow”, “violet”}; char **ptr[ ] = {s+3, s+2, s+1, s}, ***p; p = ptr; **++p; printf(“%s”,*--*++p + 3); }
main() { char *p="GOOD"; char a[ ]="GOOD"; printf("\n sizeof(p) = %d, sizeof(*p) = %d, strlen(p) = %d", sizeof(p), sizeof(*p), strlen(p)); printf("\n sizeof(a) = %d, strlen(a) = %d", sizeof(a), strlen(a)); }
#define f(g,g2) g##g2 main() { int var12=100; printf("%d",f(var,12)); }
Finding a number multiplication of 8 with out using arithmetic operator
main() { int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }
#include<stdio.h> main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s; printf("%d",s->x); printf("%s",s->name); }