Questions tagged as 'c'

2
answers

What is the usefulness of the auto keyword in C?

The keyword auto , defined by the C language, is an old keyword and seemingly useless in language. I know that in C its function is to define that it should be stored in the stack as a local variable whose life ends with the end of th...
asked by 30.04.2017 / 18:34
2
answers

Memory Allocation and Pointers

I'm implementing a Sudoku, but I'm having a hard time filling it out. #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <math.h> #include <stdio_ext.h> typedef struct grid_info {...
asked by 03.09.2015 / 06:11
2
answers

How to print only values other than 0

Everyone, I have a question. It is possible in C to print only values other than 0. An Example: We have output: 2.56000, 5.00000, 3.60000 and 27.36800 And I want you to print as follows: 2.56, 5, 3.6 and 27.368 But with printing...
asked by 11.10.2017 / 02:08
3
answers

Arrays not started in C

How do I know how much size I should put to go through an uninitialized array []? For example in that with char []. #include <stdio.h> #include <stdlib.h> int main() { char texto[] = "Linguagem C."; /* for(int i=0; i<13;...
asked by 17.05.2015 / 04:09
3
answers

Return to beginning of condition when requested

I can not use function, I wanted to know how to go back to a certain line of code when the number 0 is pressed, for example: system(color 7); printf("Teste"); printf("Teste01"); printf("Pressione 0 para reiniciar"); scanf("%d", &jog); N...
asked by 12.06.2015 / 19:21
2
answers

Is there any Interpreter for C?

I would like to test small C code snippets in the same way I can do with Python, opening the terminal and testing command-by-command, would this be possible with c?     
asked by 26.02.2015 / 06:17
2
answers

What is the correct way to declare a string in C?

There are several ways to declare a variable of type string in C as: char *str; char str[]; char str[100]; char str[1][100]; What I would like to know is, is there a correct way to declare a variable of type string or more recommended f...
asked by 11.09.2017 / 04:27
3
answers

Union of two vectors in C

I need to merge two vectors, resulting in a third vector: a[5]={1, 2, 3, 4, 5}, b[5]={6, 7, 8, 9, 10}, c[10]; else if (select_menu == 4) { int select_f4, i, j, x; printf("Esta é uma opção que realiza a união dos conjuntos\n"); prin...
asked by 03.07.2018 / 06:40
1
answer

Print sequence of numbers repeating in arithmetic progression

Make a program to print: 1 2 2 3 3 3 ..... n n n n n n ... n for a user-informed n. Use a function that takes an integer value and prints up to the nth line. Why does not it work? #include <stdio.h> #include <...
asked by 22.09.2017 / 02:56
2
answers

Doubts about the realloc function

realloc reallocates "negatively" memory? That is, if the original size of a vector is greater than the value passed in the reallocation, will the vector be reduced? For example, if I do this: char *exemplo = calloc(256, sizeof(char)); strcp...
asked by 22.05.2017 / 07:12