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 8668679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:16:25+00:00 2026-06-12T18:16:25+00:00

g++ would nt even compile it. Where was I wrong? These are the error

  • 0

g++ would nt even compile it. Where was I wrong? These are the error message:

gcc sign.c
sign.c: In function âmainâ:
sign.c:35:2: warning: format not a string literal and no format arguments [-Wformat- security]

==================================================================================

#include "stdio.h"

int string_length(char str[]);
void string_sort(char s[]);

void string_sort(char s[])
{
    char tmpt;
    int i, j, len;
    len=string_length(s);
    for(i=0; i<len-1; i++){
            for (j=i+1; j<len; j++){
                    if (s[i] > s[j]){
                            tmpt=s[i];
                            s[i]=s[j];
                            s[j]=tmpt;
                    }
            }
    }
}


int string_length(char str[]){
    int i;
    for(i=0; i<80; i++){
            if(str[i]=='\0'){
                    return(i);
            }
    }
}

int main(){
    char words[80];
scanf("%s", words);
    printf(words);
    string_sort(words);
    printf(" ");
    printf(words);
    printf("\n");




    while ( words != " "){
            scanf("%s", words);
            printf(words);
            string_sort(words);
            printf(" ");
            printf(words);
            printf("\n");
    }
}
  • 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-12T18:16:26+00:00Added an answer on June 12, 2026 at 6:16 pm

    First, that’s just a warning message, which means the compiler detected something probably wrong but compiled your code anyway. Not all compilers give the same warnings, as you’ve noticed.

    The problem is this line (and all the other lines like it):

    printf(words);
    

    When using printf, you must use a format string, something like this:

    printf("%s", words);
    

    Otherwise, if the things you’re printing (words) happens to have any % characters in it, then printf() will treat those as formatting specifiers and try to read arguments that you haven’t supplied.

    If you just want to print a string by itself, then puts can be useful:

    puts(words);
    

    This prints words followed by a newline.

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

Sidebar

Related Questions

Pseudo code: $(document).ajaxError(function(e, xhr, options, error) { xhr.retry() }) Even better would be some
I would like my C++/CLI headers to compile even when under another platform. Of
I could never think it would be even challenging but is there any function
Does the @error line even make sense here? Would it even be hit in
One would expect that even though strings are immutable, value-equality and reference-equality would not
Why would we create a sequence even if there is a primary key?
I would like to make sure my classes are robust - even if they
I would like to use this script https://github.com/jeromeetienne/jquery-qrcode (or is there even a better
I would want to search up, down, and match case if possible. Even links
The Product Tags tab would only appear after a product has been created. Even

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.