Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing variables in C brand new to the program
    primarykey
    data
    text
    <p>okay so im trying to ask user to an input of a number and then assign that number to variable this is not happening with this obviously.I also want it to then print the variable made. Please explain when the variable is assigned and where the number goes when im asking for it.</p> <p>Coming from python so don't know what else to do but ask it this way</p> <pre><code>h=raw_input('please enter number') print h </code></pre> <p>I want to do that in C</p> <pre><code>#include &lt;stdio.h&gt; int main() { int this_is_a_number; printf( "Please enter a number: " ); scanf( "%d", &amp;this_is_a_number ); printf( "You entered %d", this_is_a_number ); a=%d printf(a) return 0; } </code></pre> <p>Why is this one not working I thought it addressed the problems #include </p> <pre><code>int main() { int this_is_a_number; int a; printf( "Please enter a number: /n" ); scanf( "%d", &amp;this_is_a_number ); printf( "You entered %d", this_is_a_number ); a=this_is_a_number printf("%d/n",&amp;a) return 0; } </code></pre> <p>Here are errors for most recent code:</p> <pre><code>Building m.obj. C:\Users\Admin\Google Drive\firstCShit\m.c(4): warning #2117: Old-style function definition for 'main'. C:\Users\Admin\Google Drive\firstCShit\m.c(12): error #2001: Syntax error: expected ';' but found 'printf'. C:\Users\Admin\Google Drive\firstCShit\m.c(14): warning #2234: Argument 2 to 'printf' does not match the format string; expected 'int' but found 'int *'. C:\Users\Admin\Google Drive\firstCShit\m.c(14): error #2001: Syntax error: expected ';' but found 'return'. *** Error code: 1 *** Done. </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload