User Profile

Collapse

Profile Sidebar

Collapse
swapnaoe
swapnaoe
Last Activity: Jan 21 '08, 12:15 PM
Joined: Jul 24 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • swapnaoe
    replied to Empty array as argument to a function in C
    in C
    thats the worry.. the compiler doesnt throw any error. my question is why doesnt it throw any error.

    main()
    {
    int a[];

    }
    throws an error empty array declaration whereas the same thing declared in function definition as part of its arguments doesnt throw any such error!!...
    See more | Go to post

    Leave a comment:


  • swapnaoe
    started a topic Empty array as argument to a function in C
    in C

    Empty array as argument to a function in C

    Hi all,

    An empty array declared in a called function is used as a pointer to hold the address of an object passed in the calling function. this is perfectly legal.
    {/*calling function*/
    ...
    my_function(&in t_variable);
    ...
    }


    /*my function definition*/
    my_function(int i[])
    {
    ......

    }

    my question is why doesnt the compiler...
    See more | Go to post

  • swapnaoe
    replied to Structure member lvalue
    in C
    'A member which doesnt represent a bit field"=>
    Point1:
    doesn't this imply the other members which can be defined in a structure like predefined datatypes like int,char, and user-defined ones like structures, unions etc?

    Point2:
    If something(membe rs of a structure other than bit feilds) is defined by negating its opposite(in this case bit feild),then that definition(qual ifying) is not applicable to its...
    See more | Go to post

    Leave a comment:


  • swapnaoe
    replied to Structure member lvalue
    in C
    It says a bit field cannot be qualified with either of the qualifiers....
    See more | Go to post

    Leave a comment:


  • swapnaoe
    started a topic Structure member lvalue
    in C

    Structure member lvalue

    Hi all,

    I was going through one article on Structures and Unions on net. I found this statement. Couldn't understand what it means.. Can anyone explain me what it means if it makes sense.

    ----------------------------------------------------------------------------------------------------------------
    ' A member that does not represent a bit field can be qualified with either of the type qualifiers volatile or const....
    See more | Go to post

  • swapnaoe
    replied to Purpose of Structure Alignment Rules
    in C
    Thanks to all. That was very informative on structures....
    See more | Go to post

    Leave a comment:


  • Alright. Please consider this example.

    void main()
    {
    int x=4;
    func(x,x++);
    }
    func(int x, int y)
    {
    /*Some definition*/
    printf("%d\t%d\ n",x,y);
    }
    -----------------------------------------------------------------------------------------------------------------
    My concern was about the statement which i quoted in my prevoius post.According to it, the...
    See more | Go to post

    Leave a comment:


  • swapnaoe
    replied to Difference between implementations of union
    in C
    Global and local initialization of i..
    See more | Go to post

    Leave a comment:


  • swapnaoe
    started a topic Postfix and Prefix operator with respect to functions
    in C

    Postfix and Prefix operator with respect to functions

    Hi,

    In http://elearning.embnet.org/file.php...---and---.html I read about postfix and prefix unary operators.

    It said " If the increment or decrement operator is used as a prefix, the operation is performed before the function call. If the operator is used as a postfix, the operation is performed after the function call. "

    So accordingly
    int x=4;
    ...
    See more | Go to post

  • swapnaoe
    replied to Purpose of Structure Alignment Rules
    in C
    I am very sorry about it... :)
    Yeah u very right...
    long
    int
    short
    char
    char

    Gives 12 bytes.

    Regards
    See more | Go to post

    Leave a comment:


  • swapnaoe
    replied to How to open *bin using C language
    in C
    .bin files are the executables you get after compiling(inclu des linking) any programming code....
    See more | Go to post

    Leave a comment:


  • swapnaoe
    replied to Purpose of Structure Alignment Rules
    in C
    You said the best way to minimize the number of padding bytes, the structure members should be declared in the descending order of their sizes.
    I executed a structure declared its members in the follwoing orders.

    char,short,int, char,long 16 bytes(structure size)
    long,short,char ,char,int 12 bytes
    char,long,char, short,int 20 bytes
    long, short,int,char, char 16 bytes
    char,char,short ,int,long 12 bytes...
    See more | Go to post

    Leave a comment:


  • swapnaoe
    replied to Purpose of Structure Alignment Rules
    in C
    Banfa,

    Thanks again.
    Request you to exaplin me the terminologies:

    2 byte aligned
    4 byte aligned

    I understand that '2 byte aligned' means, a data type whose size is 2-bytes, has to be stored in memory only at even addresses(inclu ding 0) like 2,4,6....
    4 byte aligned, means a data type whose size is 4-bytes has to be stored at memory addresses which are multiples of 4(including 0)....
    See more | Go to post

    Leave a comment:


  • swapnaoe
    replied to return() syntax
    in C
    Hi,

    No I would want to finish the entire code in one line

    int x=2,y=3;
    return(x=2*y, y=x*x);

    it would return 36 and not 4 because the expression in ( ) of return statement evaluates from left to right because of comma operator. That was my intention.

    regards
    Swapna
    See more | Go to post

    Leave a comment:


  • swapnaoe
    replied to Purpose of Structure Alignment Rules
    in C
    Hi
    Explanation well understood. Thanks.
    But padding of bytes create 'holes' and block memory usage.What do u have to say on this?

    Regards
    Swapna
    See more | Go to post

    Leave a comment:


  • swapnaoe
    started a topic Purpose of Structure Alignment Rules
    in C

    Purpose of Structure Alignment Rules

    Hi,
    I would like to know why structure alignment rules were introduced.
    How does a structure with/without boundary alignments differ.

    Regards
    Swapna
    See more | Go to post

  • swapnaoe
    replied to Progress Bar for unknown time
    Hi, Thank u for the relpy but could you please elaborate on your solution....
    See more | Go to post

    Leave a comment:


  • swapnaoe
    started a topic Progress Bar for unknown time

    Progress Bar for unknown time

    Hi,
    I have an application that writes data from PC to a 8052 microcontroller 's Flash.
    It takes an accountable amount of time.I want to show a progress bar for the same but i cannt quantify the time(time it takes to complete writing all bytes to the falsh).I have an idea on progress bars with minimum and maximum limits known.I would like to know for unknown situation like my application
    Can anyone please give me kick start tips...
    See more | Go to post

  • swapnaoe
    replied to return() syntax
    in C
    Hey,

    Thanks for the reply.Scenario with multiple expressions seperated by comma for eg:return(x=2y, y=x*x) something like this where x and y are static variables.
    y=x*x will be evaluated ?

    Thanks...
    See more | Go to post

    Leave a comment:


  • swapnaoe
    started a topic return statement
    in C

    return statement

    Can anyone explain me the output of the following code

    char *rev(int val);
    void main()
    {
    extern char dec[];
    printf("%c", *rev);
    }
    char *rev(int val)
    {
    char dec[]="abcde";
    return dec;
    }
    See more | Go to post
No activity results to display
Show More
Working...