Hello...i have a problem with xcode...i am  a beginner user on mac and i am learning to program in C but lastime when i tried to compil a file with xcode it doens't function at well and i dont know while...her is my code source if somebody can help me

#include <stdio.h>
#include <stdlib.h>
#define N 20
int main (int argc, const char * argv[])
{  FILE *fp;
    char nome_file[N];
    int i,j;
    int dim;
    float mat_in[N][N];
    float mat_out[N][N];
        // apertura del file
    printf("nome_file:");
    scanf("%s",nome_file);
    fp=fopen(nome_file, "r");
    if (fp==NULL) {
        printf("errore nell'apertura del file %s\n",nome_file, );
        return -1;
    fscanf(fp, "%d",&dim);
    printf("%d\n",dim);
    for (i=0; i<dim; i++) {
        for (j=0; j<dim; j++) {
            fscanf(fp, "%f",&mat_in[i][j]);
            printf("%.2f",mat_in[i][j]);
    int ordine_grandezza=1;
    for (i=0; i<dim; i++) {
        for (j=0; j<dim; j++) {

here is my complete code source:
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#define N 20
int main (int argc, const char * argv[])
{  FILE *fp;
    char nome_file[N];
    int i,j;
    int dim;
    float mat_in[N][N];
    float mat_out[N][N];
        // apertura del file
    printf("nome_file:");
    scanf("%s",nome_file);
    fp=fopen(nome_file, "r");
    if (fp==NULL) {
        printf("errore nell'apertura del file %s\nnumero errore: %d",nome_file, errno);
        return -1;
    fscanf(fp, "%d",&dim);
    printf("%d\n",dim);
    for (i=0; i<dim; i++) {
        for (j=0; j<dim; j++) {
            fscanf(fp, "%f",&mat_in[i][j]);
            printf("%.2f",mat_in[i][j]);
    int ordine_grandezza=1;
    for (i=0; i<dim; i++) {
        for (j=0; j<dim; j++) {
            if (mat_in[i][j]<=0){
                mat_out[i][j]=0;
            else {
                while (mat_in[i][j]>ordine_grandezza) {
                    ordine_grandezza=ordine_grandezza*10;
                mat_out[i][j]=ordine_grandezza;
    for (i=0; i<dim; i++) {
        for (j=0; j<dim; j++){
            printf("%8.2f",mat_out[i][j]);
        printf("\n");
    int simmetric=0;
    for (i=0; i<dim && simmetric!=1; i++) {
        for (j=i+1; j<dim && simmetric!=1; j++){
            if (mat_out[i][j]!=mat_out[j][i])
                simmetric=1;
    if (simmetric==1)
        printf("matrice simmetrica\n");
    else
        printf("matrice non simmetrica\n");
    return 0;
and when i compil it shows it:
nome_file:martin.txt
errore nell'apertura del file martin.txt
excuz me if i dont speak english very well....but i think that the problem is that i don't know to compil a file on xcode...and if yo can send me a tutorial about it i will be grateful

Similar Messages

Maybe you are looking for