input - Simple cube and square sum function won't run (C) -


learning c, trying code program outputs sum of cube , square of inputted number.

#include <stdio.h>  main() { int a; scanf("%d",a); printf("%d",cube(a)+sqr(a)); }  cube(int x) { return(x*x*x); }  sqr(int arg) { return(arg*arg); } 

when run program outputs seemingly random string of numbers after input number. way fix without changing usage of returns assign variables?

scanf needs pointer:

scanf("%d",&a); 

instead of

scanf("%d",a); 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -