Skip to main content

All Questions

0 votes
0 answers
74 views

Confused with "inline" keyword in C [duplicate]

#include <stdio.h> inline int b(int x) { return x*2; }; int main() { printf("Hello World %d", b(3)); return 0; } Output: /usr/bin/ld: /tmp/ccGGQWnl.o: in function 'main'...
Xfce4's user avatar
  • 567
2 votes
2 answers
75 views

A function returning anonymous structure

Why is the following construct invalid: struct { int a, b; float c; } func () { struct { int a, b; float c; } test; return test; //return (struct { int a, b; float c; }){0,0,0.0}; /* ...
Edenia's user avatar
  • 2,528
0 votes
0 answers
48 views

How to use modularized functions inside other modularized functions in C

I'm doing a more complex project in c, but this example here is the same for what i need and the names of examples will just changed, but, again, is the same thing from what i am doing. Let's say I ...
Ramon Jales's user avatar
0 votes
2 answers
145 views

Why do I get this error: array type has incomplete element type, type of formal parameter is incomplete?

I am working on an assignment which involves creating a program in C to create a student database using array of structures. Following is my code: #include<stdio.h> void accept(int no, struct ...
curiosity's user avatar
0 votes
0 answers
32 views

Why does "Undefined Reference to" error occur while included header holds the referenced function? [duplicate]

I am writing a simple C program that changes the value of a data structure to 100. #include"node.h" #include <stdio.h> int main() { simpleObject object1; object1.x = 200; ...
Tricide's user avatar
1 vote
1 answer
36 views

Error: expected declaration specifiers or ‘...’ before ‘Nanar_t’

here is my code, I think you will only need this piece: struct Nanars{ char* nom; int duree; int cote; int idClient; }Nanar_t; int trouverDureeMin(int nb, int a, Nanar_t* nana[nb]){ ...
yougs dnt's user avatar
0 votes
0 answers
45 views

warning when returning an array using variadic function in c" warning: function returns address of local variable" [duplicate]

i tried to create a function that return an array of sum and average ,but iam stuck with a problem in the return the problem is: warning: function returns address of local variable [-Wreturn-local-...
user84999's user avatar
  • 101
-3 votes
2 answers
474 views

I was trying to declare a function which takes a string as an input and give an int as an output [closed]

my code is not identifying type string. I am using c to program
Muhammed Rafi's user avatar
-1 votes
1 answer
27 views

C Structures Definition inside Function [closed]

I was trying to make structure variable inside a function returning structure. Now for some reason, I am not able to instead it shows an error. #include<stdio.h> struct Vector{ int x; ...
RACHIT MITTAL's user avatar
0 votes
0 answers
27 views

Why it is compiling it as an infinite loop instead for finite one? [duplicate]

/* ques: print the numbers from 0 to n, if n is given by the user. */ #include <stdio.h> #include <math.h> int main() { int x; printf("enter the value you want to ...
Ajinkya Jaipurkar's user avatar
0 votes
0 answers
19 views

Unable to use exp() with a variable [duplicate]

This has been solved I am trying to use exp() from math.h in C, but it is failing to compile whenever I pass a variable as the argument. The following code works just fine #include <math.h> #...
MrGorbunov's user avatar
0 votes
0 answers
63 views

multiple definition of `function' error occurring on the same line as "first defined here"

error log paging.c: In function ‘setup_paging_structures’: paging.c:7: warning: implicit declaration of function ‘printf’ rm -f bootimg gcc -nostdlib -static boot.o paging.o x86_desc.o i8259.o kernel....
TecherTekkers's user avatar
0 votes
0 answers
57 views

What do you do when you encounter errors in C that require easy solutions but when you look for the error it doesn't seem to be there?

I just started learning and I'm doing functions in C but I checked and there doesn't seem to be something missing in it. Can you please check what I did wrong, I'm very open to criticism and I would ...
user avatar
-1 votes
1 answer
7k views

Why does the compiler is giving me this: undefined reference to function?

Ok I have been trying to figure this out for 3 hours and I have search a bunch of stack overflow questions and answers but I have this same error: /usr/bin/ld: /tmp/ccXbXNRV.o: in function 'main': ...
ops400's user avatar
  • 3
-2 votes
2 answers
139 views

Function like macro passed as an argument. Compiler error coming [closed]

When I am passing a function like macro as an argument to another function having declared as a function pointer argument. I am not able to run the code getting compile time error. #include <stdio....
Harsh Jain's user avatar

15 30 50 per page
1
2 3 4 5