Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - #include <stdio.h>
 - #include <stdlib.h>
 - int main(){
 - int i, j, linhas, colunas, ve;
 - int *pLinhas, *pColunas, *pVetor;
 - int matriz[3][3], vetor[3];
 - printf("Digite o numero de linhas: ");
 - scanf("%d", &linhas);
 - printf("Digite o numero de colunas: ");
 - scanf("%d", &colunas);
 - pLinhas = (int*) malloc(linhas* sizeof(int));
 - pColunas = (int*) malloc(colunas* sizeof(int));
 - pVetor = (int*) malloc(linhas)
 - // int matriz[linhas][colunas], vetor[linhas*colunas];
 - for(i=0; i<linhas; i++){
 - for(j=0; j<colunas; j++){
 - scanf("%d", &matriz[i][j]);
 - }
 - }
 - for(j=0; j<linhas; j++){
 - vetor[j] = matriz[0][j];
 - }
 - for(j=linhas; j<linhas*colunas; j++){
 - vetor[j] = matriz[0][j];
 - }
 - printf("\nMatriz:\n");
 - for(i=0; i<linhas; i++){
 - for(j=0; j<colunas; j++){
 - printf("%d ", matriz[i][j]);
 - }
 - printf("\n");
 - }
 - printf("\nVetor:\n");
 - for(i=0; i<linhas*colunas; i++)
 - printf("%d ", vetor[i]);
 - return 0;
 - }
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment