Skip to content
Snippets Groups Projects
Commit 321fbeb2 authored by Vignesh  C's avatar Vignesh C
Browse files

square root attempt using function pointer

parent 855fa124
No related branches found
No related tags found
No related merge requests found
#include<stdio.h>
int main(){
printf("welcome to my c-programming projects");
}
\ No newline at end of file
two.c 0 → 100644
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int square(int n);
int input_num();
int main(){
int hold;
hold = input_num();
int (*fnt)(int);
fnt = &square;
printf("the square root: %d\n",fnt(hold));
}
int square(int n){
int res = n * n;
return res;
}
int input_num(){
char num[20];
printf("Enter the number for square: ");
fgets(num, sizeof(num), stdin);
return atoi(num);
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment