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

  • Home
  • SEARCH
  • 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 3350762
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:49:35+00:00 2026-05-18T01:49:35+00:00

This code gives me warnings: $ cat test.c #include<stdio.h> #include<time.h> int main() { time_t

  • 0

This code gives me warnings:

$ cat test.c
#include<stdio.h>
#include<time.h>

int main() {

    time_t t;
    scanf("%lld", &t);
    printf("%lld\n", t);
    return 0;
}
$ gcc test.c -o test
test.c: In function ‘main’:
test.c:7: warning: format ‘%lld’ expects type ‘long long int *’, but argument 2 has type ‘time_t *’
test.c:8: warning: format ‘%lld’ expects type ‘long long int’, but argument 2 has type ‘time_t’
$ 

Apart from the warnings, the code works as expected.

What should I do to not get the warnings on compilation (no compiler pragma tricks please)?

  • 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-05-18T01:49:35+00:00Added an answer on May 18, 2026 at 1:49 am

    The exact type of time_t depends on your platform and OS. It’s still quite often 32 bit (either int or long), not 64, and some even use floats. The correct thing to do is to read into a known-size integer (either int or long long) and then assign the value to a time_t as a second step.

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

Sidebar

Related Questions

This very simple code gives me tons of errors: #include <iostream> #include <string> int
Consider this code: int main() { int e; prn(e); return 0; } void prn(double
For this code: int i=0; char **mainp; for(i=0;i<2;++i) { mainp[i]=malloc(sizeof(char)*200); if(!scanf(%[^#],#,mainp[i])) break; if(i<2) scanf(%[^#],#,mainp[i]);
Can anyone explain why this code gives the error: error C2039: 'RT' : is
This code in JS gives me a popup saying i think null is a
The code below gives me this mysterious error, and i cannot fathom it. I
The following code in javascript gives me the error this.callback is not a function
In the following code, g++ gives this error : 1.cpp: In member function void
after doing some test-code for this link : Is it safe to call temporary
I have this code to open multiple files one at a time that is

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.