C Programming - Pointers - Discussion
Discussion Forum : Pointers - Find Output of Program (Q.No. 14)
                   
                                       
                                14.
What will be the output of the program ?
 
                                    #include<stdio.h>
int main()
{
    char *str;
    str = "%d\n";
    str++;
    str++;
    printf(str-2, 300);
    return 0;
}
Discussion:
43 comments Page 4 of 5.
                
                        Rani said: 
                         
                        9 years ago
                
                How we can assign are   str= %d/n? 
Is strcpy not necessary here?
                Is strcpy not necessary here?
                     (1)
                
            
                        Vijay said: 
                         
                        2 decades ago
                
                Hi guys,
 
Can anyone give the explanation for this problem?
                Can anyone give the explanation for this problem?
                        Nejat said: 
                         
                        10 years ago
                
                How do we know that the string is first initialized to 300?
                
                        Shobika said: 
                         
                        8 years ago
                
                How char pointer stores the "%d\n"?
                
                     (2)
                
            
                        Swaroopa said: 
                         
                        9 years ago
                
                Thanks for your answers and explanation.
                
                     (1)
                
            
                        Balaji said: 
                         
                        8 years ago
                
                Here, Str ++means address increment.
                
                        Satakshi said: 
                         
                        1 decade ago
                
                Please some explain it step by step?
                
                        Pavan said: 
                         
                        1 decade ago
                
                Thank you sohan and archana.
                
                        Sunitha said: 
                         
                        1 decade ago
                
                Thank you very much archana.
                
                        Amol said: 
                         
                        10 years ago
                
                Nice explanation.
                Post your comments here:
 
            
        Quick links
                            Quantitative Aptitude
                                    
                                    Verbal (English)
                                    
                                    Reasoning
                                    
                                Programming
                                    
                                    Interview
                                    
                                     Placement Papers