Questions tagged as 'c'

2
answers

Use of conditions in arrays

I need to make a program that reads a 4X4 matrix and then sums the values in each row and then each column. I'm not sure how to define my condition. #include <stdio.h> int main() { int valores[4][4]; int i,j, somacol, somalin; for(i=0;...
asked by 27.09.2015 / 03:52
3
answers

Function with reference passage

I'm trying to make a simple function that counts diamonds, each diamond is given by a pair of '<' and '>'. But I'm trying to do pointers, but it's not giving me the correct result. I followed the "Simple didactics for pointers" , and acco...
asked by 02.01.2015 / 04:51
2
answers

Program always returns the same result in C

The code runs normal but only one output: Sunday ! regardless of the number chosen. What the program should do Implement a program that has a number ( 1-7 ) that corresponds to one of the days of the week and print the name of the corresp...
asked by 11.03.2015 / 04:32
2
answers

How to write numbers between 0 and 10

I would like to understand how to write to a file, numbers from 0 to 10, from this code: main(){ setlocale(LC_ALL,"Portuguese"); int num[10],i; FILE *arquivo; arquivo = fopen("c:\Ling_C\resultado.txt","a"); if(arquivo==NU...
asked by 26.10.2017 / 18:10
1
answer

Problem with exercise of C

The exercise asks for this: 5. Make a program that reads a sequence of numbers between 1 and 20 and shows how many times each number has appeared. The sequence of numbers ends with a number equal to zero. I have tried everything, I can not do...
asked by 13.08.2014 / 05:34
2
answers

Why am I getting Segmentation fault dynamic array?

They say not to cast on the return of the malloc function, but this code there if the array dimension is greater than 4, gives segmentation fault from matriz[5][1] in the count: / p> int main(){ int tamanho = 5; float...
asked by 30.09.2016 / 22:32
2
answers

String pointer does not work as expected

I'm trying to print the string pointer below, and if I put " %s " + char* t[]; it gives error, I already put %c it prints the letter " i " I do not know why. I want to learn and not ctrl + c and ctrl Also appeare...
asked by 23.10.2016 / 02:05
2
answers

Find number of times a character appears in a word using recursion

   Develop an algorithm that reads a word ( string ) and a character and returns the number of times that character appears in the word. The algorithm must be recursive.       Input and Output Examples:       Entry: araraquara a       Outpu...
asked by 08.06.2017 / 05:12
3
answers

Print a character in place of a number

#include<stdio.h> #include<string.h> int main() { char str[50]; int i, l = 0; printf(" We will count the number of letters\n"); printf("-------------------------------------\n"); printf("Tell me the word: \n");...
asked by 22.12.2016 / 00:16
2
answers

Copy Strings in C

I have the following two-dimensional array of strings. char matriz[linhas][tamanhoDaString] Through strcpy I copied a string there. char *aux = "abc"; strcpy(matriz, aux); My goal was to set linha 3 to aux . H...
asked by 23.03.2014 / 16:15