Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
 main()
{
 char *a = "a";
 *a = 'r';
 printf(a);
}

1. What is the output ?

C#
main()
{
 int a;
 int *p;
 a = 5;
 p = &a
 printf(a,p,*p);
}

2. What is the output ?

3. Difference between the flowing structure
struct pack
{
 unsigned int a:9;
} p;
struct pack
{
 unsigned int a;
} p;


struct data
{
 char name[80];
 double age;
}
 const data MyStruct = { "a", 1000 };
 strcpy (MyStruct.name, "p");
 printf(MyStruct.name);


4. Output ?

fib(n)
  if(n = 0)
     return 0
  if(n = 1)
     return 1
  
   return fib(n -1) + fib(n - 2)

5. Simulate fin(5)
Posted
Updated 29-Mar-11 4:22am
v2
Comments
Sandeep Mewara 29-Mar-11 11:54am    
Homework it is! :doh:

No effort.

Normally a memory violation error: "a" is a static string, and you should not be allowed to change it.
 
Share this answer
 
It won't compile so there is no output. printf is not a built in function, operator nor type.

Most likely cause is a missing include of stdio.h.

That would be my response in a job interview.
 
Share this answer
 
v2
Comments
UL UL ALBAB 29-Mar-11 10:26am    
lol... Suppose you have include stdio.h. Than what will the output ?
Output is: r
There is no error! yeah.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900