Search:

Type: Posts; User: Mr.Lnx

Page 1 of 15 1 2 3 4

Search: Search took 0.02 seconds.

  1. Replies
    10
    Views
    779

    Thank you very much for your time laserlight :)

    Thank you very much for your time laserlight :)
  2. Replies
    10
    Views
    779

    Ok.So we have 8 * 8 = 64bits hence 2 storage...

    Ok.So we have 8 * 8 = 64bits hence 2 storage units of 32. The layout would be :




    |__4 bits for a member___|___28bits padding___| |___8bits for member b____|__24bits...
  3. Replies
    10
    Views
    779

    So the unnamed 0-bit member does not occupy any...

    So the unnamed 0-bit member does not occupy any memory ok.
  4. Replies
    10
    Views
    779

    Yes I meant that each unsigned int occupies 4...

    Yes I meant that each unsigned int occupies 4 bytes in the memory so the result of sizeof(my_s) I expected instead of 12 bytes not 8 that is why I think I have no understand the concept of bit...
  5. Replies
    10
    Views
    779

    #include typedef struct s { unsigned...

    #include <stdio.h>
    typedef struct s {
    unsigned int a: 4;
    unsigned int: 0;
    unsigned int b: 8;
    } my_s;

    int main(void) {

    printf("%d , %d" , sizeof(unsigned int) , sizeof(my_s));
  6. Replies
    10
    Views
    779

    Bit Fields example.

    Hello to all. There is a point that I can't understand.




    struct s {
    unsigned int a: 4;
    unsigned int: 0;
    unsigned int b: 8;
    }
  7. Replies
    3
    Views
    798

    I mean it doesn't open the file at the task...

    I mean it doesn't open the file at the task manager.

    I used Nominal Animal code too I didn't see the difference only the message that is opened succesfully.
  8. Replies
    3
    Views
    798

    How to use the right path with fopen?

    Hello to all. I have Geany IDE and gcc compiler. I have the following code :





    #include<stdio.h>
    #include<stdlib.h>
    #define FILE_NAME "/home/kostas/PROGRAMS/simple"
    int main(void)
  9. @Nominal ok we have a structure with members (one...

    @Nominal ok we have a structure with members (one integer and seven characters) that have 11 byte size (assuming that int is 4 and each character 1 byte) so 16byte size and 8byte alignment. (5 bytes...
  10. As the program begins. There is no something that...

    As the program begins. There is no something that you call "metadata" for dynamically allocated chunk 1 at the beginning because malloc hasn't called yet.
  11. @Nominal Thank you for the big explanation. I...

    @Nominal Thank you for the big explanation. I have some queries though

    I don't understand what is [ C library metadata for dynamically allocated chunk n ] for example is only a label for your...
  12. @Nominal Animal the correct version of...

    @Nominal Animal

    the correct version of read_line function I think is :



    int read_line(char str[] , int n)
    {
    int ch , i =0 ;
    while( (ch= getchar()) !='\n' && i<n)
  13. Pointing to a flexible array member (C99). How do we know the point in the array?

    Hello to all.

    I have this code :




    /*********************************************************
    * From C PROGRAMMING: A MODERN APPROACH, Second Edition *
    * By K. N. King ...
  14. Hmm ok. I got it. With the restrict keyword we...

    Hmm ok. I got it. With the restrict keyword we don't want two pointers point to the same thing. Pointing to the same thing is always a possibly situation for overlapping.We should use memmove instead...
  15. Replies
    1
    Views
    810

    First of all you need to read the string from the...

    First of all you need to read the string from the user. So you want a function for it. I suggest you using fgets function.

    fgets - C++ Reference

    After all you need to make your process in your...
  16. Sorry but how is from one pointer? s[i] is also a...

    Sorry but how is from one pointer? s[i] is also a pointer right? the function treats it as a pointer on its body like we know. And d[i] is also a pointer in the function only! So we copy from s[i] to...
  17. I mean that is canceled. When you say that you...

    I mean that is canceled. When you say that you declare a pointer to be restricted how you can have access from some other? live the previous examples. The only access is from one pointer.

    For...
  18. Ok but with this the concept of restriction of a...

    Ok but with this the concept of restriction of a pointer does not corrupted?

    The behavior if you have an access to a pointer that have been declared as restricted does not undefined?
  19. And why my book writes : "A pointer that is...

    And why my book writes :

    "A pointer that is been declared using restrict is called restricted pointer.The intent is that if p points to an object that is later modified ,then that object is not...
  20. The keyword restrict in the prototype of memcpy function.

    I have a query about memcpy's prototype.

    Since the arguments are restricted pointers and according to a restricted pointer only that pointer has access to the object how the function works? and...
  21. Thread: memcpy function

    by Mr.Lnx
    Replies
    1
    Views
    753

    memcpy function

    I have a query about memcpy's prototype.

    Since the arguments are restricted pointers and according to a restricted pointer only that pointer has access to the object how the function works? and...
  22. Replies
    4
    Views
    1,504

    int calsum(int x, int y , int z); is only a...

    int calsum(int x, int y , int z); is only a declaration of the funtion in order to help the compiler to check the call later.

    The values goes to the call. After the call the value of the function...
  23. Replies
    4
    Views
    1,504

    #include int calsum (int x, int y, int...

    #include <stdio.h>
    int calsum (int x, int y, int z);
    int main(void)
    {
    int a, b, c;

    printf ("Enter any three numbers");
    scanf ("%d %d %d", &a, &b, &c);
    printf ("Sum = %d\n", calsum(x,y,z));
  24. @laserlight yes you are right. I changed my first...

    @laserlight yes you are right. I changed my first post.
  25. First of all you need an array of strings. So...

    First of all you need an array of strings. So this is easy with an array of pointers for example :


    char *planets[] = { "Mercury" , "Venus" , "Earth" , "Mars" , "Jupiter" , "Saturn" , "Uranus"...
Results 1 to 25 of 358
Page 1 of 15 1 2 3 4