DO NOT POST EMAIL ADDRESSES
That code all works. However what you've included there is not a complete C program.
You should assign values to the variables a and b so that you don't just have random values. Further, you should print out the value of c each time.
The insmod command makes zero sense. There is no module to insert.
EDIT: Sorry you did say "kernel programming". Well then you've apparently written a module. Please post the entire module and describe what you've done to compile it.
You write a C program, compile it using something like
gcc(1) and then you run it from your terminal/command prompt.
So let's start with the beginning. Please use
[code][/code] tags around your code, there are instructions in the LQ FAQ as well as a link in my signature.
Post all of what you have for code.
Or is all you have what you typed in?
Quote:
Originally Posted by varun r
float a,b,c;
c=a+b;
c=a-b;
c=a*b;
|
If so, then you haven't written a complete C program, such as the classic example:
Code:
// Sample file: hello.c
#include <stdio.h>
void main(void)
{
printf("Hello World!\n");
}
And you compile that using GCC:
Code:
$ gcc -o hello hello.c
And then you run it from the command line:
Code:
$ ./hello
Hello World!
$
Extend that example to put your math code in the program as opposed to just printing Hello World! and also print out the value of c after each computation. Suggest you look up how to use printf() formatting to output a float value.
My personal suggestion moving to a future step is to consider double over float. Just my personal take, float variables do work here.