2 Replies - 177 Views - Last Post: 24 August 2019 - 06:05 AM Rate Topic: -----

#1 Caedmon   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 23-August 19

I am having trouble calling fuctions in C language. Can you please hel

Posted 24 August 2019 - 04:35 AM

I have prototyped my 2 functions before the main function.
In lines 14 and 16 I have an if statement to call the respective function. But when I run the program, the functions are not called.

Attached image(s)

  • Attached Image

Is This A Good Question/Topic? 0
  • +

Replies To: I am having trouble calling fuctions in C language. Can you please hel

#2 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6818
  • View blog
  • Posts: 28,231
  • Joined: 12-December 12

Re: I am having trouble calling fuctions in C language. Can you please hel

Posted 24 August 2019 - 06:04 AM

Post the code as text, wrapped in code tags.
Was This Post Helpful? 0
  • +
  • -

#3 jimblumberg   User is offline

  • member icon

Reputation: 5762
  • View blog
  • Posts: 17,641
  • Joined: 25-December 09

Re: I am having trouble calling fuctions in C language. Can you please hel

Posted 24 August 2019 - 06:05 AM

In future please cut and paste code into your post inside code tags.

:code:

Line 14 and 16 are not calling your functions, they are actually prototypes not function calls. Please see the Function tutorials contained in my signature below for more information about using functions.

Also you should never use a function that doesn't limit the number of characters it will try to retrieve into a string to help avoid overflowing the bounds of your strings. The scanf() function can be limited by using the proper optional width specifier in the format string (scanf("%19s", answer)). Note that the width specifier must be one less than the size of the string since scanf() will automatically append the end of string character onto the string so you must save room for that character.

Jim
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1