Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7808495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:09:03+00:00 2026-06-02T03:09:03+00:00

#include <stdio.h> #include <stdlib.h> #include <uuid/uuid.h> int main(void) { puts(!!!Hello World!!!); /* prints !!!Hello

  • 0
#include <stdio.h>
#include <stdlib.h>  
#include <uuid/uuid.h>

int main(void) {
    puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
    uuid_t uuid;
    int uuid_generate_time_safe(uuid);
    printf("%x",uuid);
    return EXIT_SUCCESS;
}

I just wonder why uuid is not 16 bytes long?
I use DEBUG to view the memory, It is indeed not 16 bytes.
And I use libpcap to develop my program, The uuid is not unique.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T03:09:05+00:00Added an answer on June 2, 2026 at 3:09 am

    I just tried your program on my system, and uuid is 16 bytes long. But your program doesn’t display its size.

    The line:

    int uuid_generate_time_safe(uuid);
    

    isn’t a call to the uuid_generate_time_safe function, it’s a declaration of that function with uuid as the (ignored) name of the single parameter. (And that kind of function declaration isn’t even valid as of the 1999 standard, which dropped the old “implicit int” rule.)

    Your printf call:

    printf("%x",uuid);
    

    has undefined behavior; "%x" requires an argument of type unsigned int.

    If you look in /usr/include/uuid/uuid.h, you’ll see that the definition of uuid_t is:

    typedef unsigned char uuid_t[16];
    

    The correct declaration of uuid_generate_time_safe (see man uuid_generate_time_safe) is:

    int uuid_generate_time_safe(uuid_t out);
    

    You don’t need that declaration in your own code; it’s provided by the #include <uuid/uuid.h>.
    Because uuid_t is an array type, the parameter is really of type unsigned char*, which is why the function is seemingly able to modify its argument.

    Here’s a more correct program that illustrates the use of the function:

    #include <stdio.h>
    #include <uuid/uuid.h>
    
    int main(void) {
        uuid_t uuid;
        int result = uuid_generate_time_safe(uuid);
        printf("sizeof uuid = %d\n", (int)sizeof uuid);
        // or: printf("sizeof uuid = %zu\n", sizeof uuid);
        if (result == 0) {
            puts("uuid generated safely");
        }
        else {
            puts("uuid not generated safely");
        }
        for (size_t i = 0; i < sizeof uuid; i ++) {
            printf("%02x ", uuid[i]);
        }
        putchar('\n');
        return 0;
    }
    

    On my system, I got the following output:

    sizeof uuid = 16
    uuid not generated safely
    26 9b fc b8 89 35 11 e1 96 30 00 13 20 db 0a c4
    

    See the man page for information about why the “uuid not generated safely” message might appear.

    Note that I had to install the uuid-dev package to be able to build and run this program.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#include <stdio.h> #include <stdlib.h> int main( void ) { char *ptr1 = Hello World\n;
#include <stdio.h> #include <stdlib.h> int main() { char *str=Helloworld; printf(%d,printf(%s,str)); return 0; } output
#include<stdio.h> #include<signal.h> #include<stdlib.h> void handler(int signo) { printf(First statement); system(date); exit(EXIT_SUCCESS); } int main()
#include <string.h> #include <stdlib.h> #include <stdio.h> int main(void) { unsigned char *stole; unsigned char
#include<stdio.h> #include<stdlib.h> int fun1() { printf(I am fun1.); return 0; } int fun2(int fun())
#include <stdio.h> #include<stdlib.h> #define LIST.H onus; int main () { char *p,*s; printf( LIST.H
#include <stdio.h> #include <stdlib.h> #include <time.h> #define length 100 void print_array(); int main() {
#include <stdio.h> #include <stdlib.h> #include <string.h> void main() { typedef int (FuncPtr)(); char asmFunc[]
#include <stdio.h> #include <stdlib.h> void copyint(char *i,char** temp); int main() { char* a=00313; char*
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char *a = Hello ;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.