GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Placement Papers  >  TCS  >  C
Go To First  |  Previous Question  |  Next Question 
 C  |  Question 72 of 87    Print  
Find the output of the following program
main()
{
int x=5, *p;
p=&x
printf("%d",++*p);
}

A. 5
B. 6
C. 0
D. none of these


  
Total Answers and Comments: 1 Last Update: February 23, 2006   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
February 23, 2006 10:02:22   #1  
Rohan Member Since: November 2005   Contribution: 11    

RE: Find the output of the following programmain(...

Ans is ( B )

  *p=5  and  ++*p=++x

   ++x = 6

  read operator precedence for more details


 
Is this answer useful? Yes | No

 Related Questions

Main must be written asa.the first function in the programb.Second function in the programc.Last function in the programd.any where in the program

Write one statement equivalent to the following two statementsx=sqr(a);return(x);Choose from one of the alternativesa.return(sqr(a));b.printf("sqr(a)");c.return(a*a*a);d.printf("%d",sqr(a));

What does the following function print?func(int i){if(i%2)return 0;eale return 1;}main(){int =3;i=func(i);i=func(i);printf("%d",i);}a.3b.1c.0d.2

A memory of 20 bytes is allocated to a string declared as char *sthen the following two statements are executed:s="Etrance"l=strlen(s);what is the value of l ?a.20b.8c.9d.21

Consider the following structure:struct num nam{int no;char name[25];};struct num nam n1[]={{12,"Fred"},{15,"Martin"},{8,"Peter"},{11,Nicholas"}};..........printf("%d%d",n1[2],no,(*(n1 + 2),no) + 1);What does the above statement print?a.8,9b.9,9c.8,8d.8,unpredictable value

Latest Answer : answer is 5 times ...

Consider the following programmain(){int a[5]={1,3,6,7,0};int *b;b=&a[2];}the value of b[-1] isa.1b.3c.-6d. none

# define prod(a,b)=a*bmain(){int x=2;int y=3;printf("%d",prod(x+2,y-10)); }the output of the program is a.8b.6c.7d.none

Consider the following program sigmentint n,sum=1;switch(n) {case 2:sum=sum+2;case 3:sum*=2;break;default:sum=0;} if n=2, what is the value of suma.0b.6c.3d.none

Find the output of the following programmain(){int x=5, *p;p=&x;printf("%d",++*p);}a.5b.6c.0d.none


 Sponsored Links

 
Related Articles

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
 

Quality Aspects to Check While Writing COBOL Program

Quality Aspects to Check While Writing COBOL Program This article gives a general list which the programmer must check while delivering programs developed in COBOL This can also be used as a general checklist for checking quality of the COBOL program developed mosgoogle Quality is a vital factor fo
 

How To Write The Main Heading For Your Essay

How To Write The Main Heading For Your Essay When you write an essay you will want to make sure you write a good heading To write a good heading you will need to plan your essay very effectively If you remember any good points from lectures these could be things you may want to use to create a good
 

Basic concepts of OOPS and Structure of C++ program

Basic concepts of OOPS and Structure of C program In this tutorial you will learn about Objects Classes Inheritance Data Abstraction Data Encapsulation Polymorphism Overloading Reusability Before starting to learn C it is essential that one must have a basic knowledge of the concepts of Object orie
 





About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape