GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  Hughes  >  Technical
Go To First  |  Previous Question  |  Next Question 
 Technical  |  Question 22 of 41    Print  
Find the output of the following C program
void f(char *p)
{p=(char *) malloc(6);
strcpy(p,"hello");
}
void main( )
{char *P="bye";
f(p);
printf("%s',p);
}

  
Total Answers and Comments: 2 Last Update: September 25, 2006   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
August 14, 2005 07:48:28   
Amit Dhamija        

RE: Find the output of the following C programvoid f(char *p){p=(char *) malloc(6);strcpy(p,"hello&...
bye will get printed
 
Is this answer useful? Yes | No
September 25, 2006 01:37:56   
Ashish and Arafat        

RE: Find the output of the following C programvoi...

Error in the program: Undefined symbol p.

Warning in the program: P has assingned a valur that is never used.


 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : its wrong cuz the no's are 900 n 280 r no's wid 7 so its280/900 or 28/90 wich can be easily done by 1/9+1/10+1/10 ...

Given the following C programfunc(){static int i = 10;printf("%d",i);i++;}What is the value of i if the function is called twice?

Given the following C programfunc(int *i, int*j){*i=*i * *i;*j=*j* *j;}main(){ int i = 5, j = 2;func(&i,&j);printf("%d %d", i, j);}

There was a circuit given using three nand gates with two inputs and one output.Find the output.A. ORB. ANDC. XORD. NOT

For the following C programvoid insert(key,r)typekey key,data array r;{extern int n;if(n>=max) /*error table if full */else r[n++].k=key;}This on executing, enables aA. Basic sequential searchB. Binary searchC. Interpolation searchD. None

Find the output of the following C programvoid f(char *p){p=(char *) malloc(6);strcpy(p,"hello");}void main( ){char *P="bye";f(p);printf("%s',p);}

Time taken to access cache is 100ns and to access memory is 1000ns.Hit ratio given. Find the average access time

Which one of the following can't be used to find an Internet address given the domain name?A. /etc/hostB. NIS yellow pagesC. DNSD. ARP

For the following C programint x(char *a){a=(char *) malloc(10*sizeof(char));*a="hello";}main(){char *a="new";x(a);printf("%s",a);}The output isA. HelloB. NewC. Hello newD. Run time error


 Sponsored Links

 
Related Articles

C++ Void Pointer and Null Pointer

C Void Pointer and Null Pointer In this C tutorial you will learn about two interesting types of pointers; void pointers and Null Pointer These pointers will be discussed in conjunction with syntax usage and example mosgoogle center Pointer to Void General Syntax void pointer variable; Void is use
 

C++ Standard Input Output Stream

C Standard Input Output Stream In this C tutorial you will learn about standard input stream and standard output stream explained along with syntax and examples C programming language uses the concept of streams to perform input and output operations using the keyboard and to display information on
 

printf() Function Return Value

What is the return value from printf() function? printf function always returns the number of characters printed. Let us understand this with an example: main() { int a=10; printf("%d",printf("%d %d %d", a,a,a)); } In this above program the inner printf i
 

How is the main() function declared?

The declaration of main can be done as int main() One more declaration that can be taken by main is command line arguments form int main(int argc, char *argv[]) or this can also be written as int main(argc, argv) int argc; char *argv[]; NOTE: It is not possible for one to declare the main
 

What happens when a variable is not initialized in main function?

When a variable is not initialized in main function it contains garbage value. This can be well seen from the example below main() { int x; printf(“%d”,x); z= sample() } sample() { printf(“Testing program”); } Output is   &n
 

How to develop compile and run a C program

The steps involved in building a C program are: 1. First program is created by using any text editor and the file is stored with extension as .c 2. Next the program is compiled. There are many compilers available like GNU C compiler called as gcc, Sun compiler, Borland compiler which is pop
 

What are the Format Specifiers used with printf?

There are several format specifiers available in printf. The format specifier used varies depending on the data type used for printing. The given below are some of the format specifiers used with printf in C program. For integer data type the format specifier used with printf is %d or %i For float
 

printf and sprintf

What is the difference between printf and sprintf? sprintf: Writes formatted data to a character string in memory instead of stdout Syntax of sprintf is: #include <stdio.h> int sprintf (char *string, const char *format [,item [,item]...]); Here, String refers to the pointer to a
 

Data Warehouses Non Technical Issues

Data Warehouses Non Technical Issues When companies get ready to implement a data warehouse few of them pay attention to the political issues that may surround it It must be emphasized that politics can reduce the chances for success with a data warehouse project and I want to warn companies against
 

Technical Aspects of CRM

Technical Aspects of CRM While it must be emphasized that CRM is not a technology there are a number of technical issues that need to be considered when a company decides to implement a CRM system The first technical issue that needs to be analyzed is scalability In a nutshell the CRM system must be
 

Related Categories
Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2010 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape