Questions tagged as 'c'

2
answers

Declaration of variables before the main () function and after the main () function in C

What is the difference between declaring any variable (in this case number ) before the function main() ? int number = 0; int main() { printf(" The number is %d\n", number); return (0); } and after it. int main() {...
asked by 07.12.2016 / 22:59
1
answer

How is correct when declaring a variable that is a pointer?

I see that some people do int* variavel; And there are those who do int *variavel; Which one is correct?     
asked by 24.01.2017 / 11:41
2
answers

How to assemble a list of generic objects in C?

In many high-level languages it is possible to have a structure or a collection of data of varying types, often using type Object for this. How to do the same in C? That is, I do not know the types that will enter the structure or arr...
asked by 30.01.2017 / 11:47
2
answers

Returning direct and array function string

What works: void *teste(); int main () { printf("\nRESULTADO: %s\n", teste()); return 0; } void *teste(){ return "Ponteiro"; } What goes wrong: void *teste(); int main () { printf("\nRESULTADO: %s\n", teste()); retu...
asked by 03.11.2017 / 15:11
2
answers

Hiperfatorial in C by recursion

I'm trying to make a program with a recursive function to return a hyper-factor from a number in C, but the only value the function returns is 1. Where am I going wrong? #include <math.h> #include <stdio.h> #include <stdlib.h>...
asked by 16.11.2017 / 19:24
3
answers

How to effect loading from the terminal in only one line?

How can I do a loading effect by giving refresh on only one line of the terminal when running a program in c? Example:    loading ... The points are increasing. I can do this in a while loop but only by clearing the screen with the...
asked by 14.04.2015 / 23:28
1
answer

Pass Array as parameter to function

Make a program in C that reads an x value, dynamically create a vector of x elements and pass that vector to a function that will read the elements of that vector. Then, in the main program, the filled vector must be printed. In addition, before...
asked by 04.05.2016 / 16:36
2
answers

How to define the size of the vector dynamically in C?

In C language I can define a vector by specifying the size for example int vet[3]; how can I set the size of the vector dynamic, for example asking the user to inform the size of the vector ?     
asked by 22.08.2015 / 03:58
3
answers

Print the data of a vector in a struct

I want to make a birthday date registration system. The final doubt is: how do I print the anniversary: 1/12/1990, 12/2/1977, 09/13/1999 and 19/04/1987. They would be the examples of the printing of the dates, but I get several numbers that have...
asked by 14.11.2014 / 14:22
2
answers

How to get the executable path open in C

How can I capture the path of the executable in C and put it inside a string ?     
asked by 03.09.2016 / 02:40