0
Why do my int num=42; code doesn't work and shows error
Plz help
13 Answers
+ 2
//Here is the C# version of MD. Ferdous Ibne Abu Bakar's code:
using System;
namespace Sololearn
{
class Program
{
static void Main(string[] args)
{
int x = 42;
Console.Write(x);
}
}
}
+ 2
8 D SAIRAJ S L.H.S you tagged C, but I see that you are taking the C# (C Sharp) Sololearn tutorial. They are distinct languages and different environments. That could be the explanation why the C codes do not work for you. Do you mean C#?
+ 2
Thanks
+ 1
//Try this code:
#include <stdio.h>
int main() {
int x = 42;
printf ("%d", x);
return 0;
}
+ 1
I meant C# (C sharp)
0
Plz help
0
Show me you code
0
int num=42;
0
Do we have to write something in first line before writing code
0
Didn't work
0
//You also could use struct
namespace Sololearn
{
class Program
{
struct integer{
public int x;
}
static void Main(string[] args)
{
integer myNum;
myNum.x = 42;
Console.Write(myNum.x);
}
}
}
0
Thanks got it
- 1
You seem to have tagged this Q & A as C#, please correct it, because based on the comments this question is about C not C#