Search:

Type: Posts; User: Saurabh Mehta

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    5
    Views
    6,001

    This wont work in case of char pointers since you...

    This wont work in case of char pointers since you cannot change contents of read only block...
  2. Replies
    5
    Views
    6,001

    swap char pointers

    I have the following code.According to this the values of pointers p[0] and p[1] remains unchanged since the swap is made to local variables in swap function.Now my doubt is how can I swap the...
  3. Replies
    3
    Views
    803

    redinition inside block

    #include<stdio.h>
    int i=5;
    main()
    {
    int i=6;
    {

    int i=7;
    printf("%d",i);
  4. Replies
    4
    Views
    856

    @jimblumberg Thank you for your answer..but my...

    @jimblumberg Thank you for your answer..but my question is that why the declaration is allowed inside switch block and not allowed inside case statement...although incase of inside switch you can...
  5. Replies
    4
    Views
    856

    c switch declaration

    #include<stdio.h>
    main()
    { switch (i)
    { case 1:
    int a = 3;
    break;
    case 2:printf("hello"); break; } }
  6. Thread: unions

    by Saurabh Mehta
    Replies
    7
    Views
    1,275

    @grumpy thank you for your valuable contribution..

    @grumpy thank you for your valuable contribution..
  7. Thread: unions

    by Saurabh Mehta
    Replies
    7
    Views
    1,275

    I think that its because of padding that extra...

    I think that its because of padding that extra bits are added..Because if i do sizeof(struct ss) it gives 16 and not 12...Please contribute if I am wrong?
  8. Thread: unions

    by Saurabh Mehta
    Replies
    7
    Views
    1,275

    Yeah that i know..in my case it means wirting to...

    Yeah that i know..in my case it means wirting to c and d means overiding the values of a and b...But why does that 32767 come??
  9. Thread: unions

    by Saurabh Mehta
    Replies
    7
    Views
    1,275

    unions

    main()
    {
    union u
    {
    struct s{int a;int b}n;
    struct ss{int c;long d}ni;


    }uu;
    uu.ni.c=1;
  10. Thread: unions

    by Saurabh Mehta
    Replies
    1
    Views
    761

    unions

    main()
    {
    union u
    {
    struct s{int a;int b}n;
    struct ss{int c;long d}ni;


    }uu;
    uu.ni.c=1;
  11. Replies
    2
    Views
    878

    Thank you...you rockkkkk!!

    Thank you...you rockkkkk!!
  12. Replies
    2
    Views
    878

    integer promotions

    I came across the foll code in c99 standard:

    Otherwise, if the type of the operand with signed integer type can represent
    all of the values of the type of the operand with unsigned integer type,...
  13. Replies
    9
    Views
    1,502

    Thank you it was great explaination ...I have a...

    Thank you it was great explaination ...I have a last doubt that does compiler decides order of evalauation or is it always left to right??
  14. Replies
    9
    Views
    1,502

    @jimblumberg thank you but even if I remove...

    @jimblumberg thank you but even if I remove paranthesis then also the result is the same i.e j is considered first and then the other parts of the expression..As far as I know precedence means That...
  15. Replies
    9
    Views
    1,502

    Thank you for your explaination but as per the...

    Thank you for your explaination but as per the foll link it says && has higher precedence than ||..So why does in my case || gets evaluated first C Language Operator Precedence Chart
  16. Replies
    9
    Views
    1,502

    precedence of relational operators

    came across the foll code:



    #include<stdio.h>

    main()
    {
    int i=4,j=7;
  17. Replies
    8
    Views
    1,538

    Then why doesnt it do the same thing when only 1...

    Then why doesnt it do the same thing when only 1 bit is increased I mean why on increasing size with just one bit it straight away increases the total size by 4 bytes??
  18. Replies
    8
    Views
    1,538

    But when I replace sizeof c with 2 bits then it...

    But when I replace sizeof c with 2 bits then it gives 8 as output ..Can someone please explain how is this possible???
  19. Replies
    8
    Views
    1,538

    bit fields

    the foll code when run on gcc compiler gave 12 as output


    struct aa{char a:3;int b:30;char c:3;};
    printf("%d",sizeof(struct aa));


    but since sizeof int is 4 and char is 1 then why does...
  20. Replies
    13
    Views
    3,811

    Thank you it was a really great explaination!!!!

    Thank you it was a really great explaination!!!!
  21. Replies
    2
    Views
    1,427

    extern variables

    The foll code


    static int a;
    extern int a;

    gave no error on gcc

    But the foll gave error :
  22. Replies
    13
    Views
    3,811

    @phantomotap thank you for your answer but in my...

    @phantomotap thank you for your answer but in my previous question when i run the code by removing static from the global variable it gave no errors why is that so??
  23. Replies
    13
    Views
    3,811

    I didnt mention 'extern' in my previous comment:)...

    I didnt mention 'extern' in my previous comment:) No problems but now I have another doubt the following code gave error as "non static declaration of 'a' follows static declaration"

    static int...
  24. Replies
    13
    Views
    3,811

    Then why does removing static gives no error...

    Then why does removing static gives no error although it is defined after main()..??
  25. Replies
    13
    Views
    3,811

    Thank you but I think static variables have...

    Thank you but I think static variables have internal linkage that is available to same file and not to outside files..
Results 1 to 25 of 50
Page 1 of 2 1 2