Thread: problem with printf

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    184

    problem with printf

    hello guys,

    the follwing code gives me an error can any one tell why it..

    Code:
    #include<stdio.h>
    #include<math.h>
    
    int main()
    {
           printf("%10s%10s%10s%10s%10s\n%10s%10s%10s%10s%10s","Integers","Squares","3rd Power","4th Power","%th Power");
        getchar();
    }
    and it gives me run time segmentation fault warning

    thax in advance

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    184
    sorry the code is working now


    very sorry about the code. i forgot to declare the string const at the end

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,666
    Consider the delights of

    gcc -Wall prog.c
    This will diagnose (amongst other things) attempts to call printf with too many, too few, wrong type parameters.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems reading entered race times C
    By loopymoo26 in forum C Programming
    Replies: 12
    Last Post: 05-23-2009, 07:38 AM
  2. Help with a C Programing Quiz project
    By dilemma in forum C Programming
    Replies: 12
    Last Post: 05-15-2009, 03:35 PM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. error in program????
    By SpEkTrE in forum C Programming
    Replies: 5
    Last Post: 11-24-2003, 06:16 PM
  5. Drawing tables in C
    By stanoman in forum C Programming
    Replies: 5
    Last Post: 10-09-2003, 10:14 AM