static reg

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jeyshree
    New Member
    • Jul 2010
    • 75

    static reg

    hai,
    please look and the snippets and explain me what is reason for the various outputs generated.
    Code:
    #include<stdio.h>
    #include<conio.h>
    Main()
    {
    Int a[5]={1,2,3,4,5};\*assuming starting address of this array as 1000*/
    Int *p[5]={a,a+1,a+2,a+3,a+4};\*assuming starting address of this array as 2000*/
    Clrscr();
    Print(“%u\n%u\n%u”,p,*p,**p);
    }
    Output:
    Error
    Code:
    #include<stdio.h>
    #include<conio.h>
    Main()
    {
    Int a[5]={1,2,3,4,5};\*assuming starting address of this array as 1000*/
    Static Int *p[5]={a,a+1,a+2,a+3,a+4};\*assuming starting address of this array as 2000*/
    Clrscr();
    Print(“%u\n%u\n%u”,p,*p,**p);
    }
    Output:
    Error
    Code:
    #include<stdio.h>
    #include<conio.h>
    Main()
    {
    Static Int a[5]={1,2,3,4,5};\*assuming starting address of this array as 1000*/
    Static Int *p[5]={a,a+1,a+2,a+3,a+4};\*assuming starting address of this array as 2000*/
    Clrscr();
    Print(“%u\n%u\n%u”,p,*p,**p);
    }
    Output:
    2000
    1000
    1
    Code:
    #include<stdio.h>
    #include<conio.h>
    Main()
    {
    Static Int a[5]={1,2,3,4,5};\*assuming starting address of this array as 1000*/
    Int *p[5]={a,a+1,a+2,a+3,a+4};\*assuming starting address of this array as 2000*/
    Clrscr();
    Print(“%u\n%u\n%u”,p,*p,**p);
    }
    Output:
    2000
    1000
    1
    thanks in advance.bye
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    None of your examples compile due to many syntax errors.

    What language do you think you are coding? What I see is not C or C++.

    It also looks like you are using a word processor to write code and that is adding errors by inserting things like smart quotes.

    Post again when you have compilable code.

    And, please use code tags.

    Comment

    Working...