Cual error te tira?
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menú
Cliente = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
char *strreplace(const char * str, const char * find, const char * replace){
unsigned int i,j,k,pos, val, size, oldsize, cont;
unsigned int bytes = strlen(str)-strlen(find)+strlen(replace);
int flag;
char * nstr = (char*)malloc(bytes+1);
memset(nstr, 0, bytes+1);
for(i = 0; i <= strlen(str)-strlen(find); i++){
flag = 1;
val = i;
k = 0;
// unsigned int z = (i+strlen(find)-1);
for(j=i; j<=(i+strlen(find)-1); j++){
if(find[k] != str[j])
flag = 0;
k++;
}
if(flag != 0)
pos = val;
}
size = pos + strlen(replace) - 1;
oldsize = pos + strlen(find);
cont = 0;
j = 0;
for(i=0;i<=bytes-1;i++){
if(i>=pos && i<=size){
nstr[i] = replace[cont];
cont++;
if(i==size)
j=oldsize;
} else {
nstr[i] = str[j];
j++;
}
}
return nstr;
}
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
char *strreplace(const char * str, const char * find, const char * replace){
int i,j,k, flag, pos = -1;
int bytes = strlen(str)-strlen(find)+strlen(replace);
char * nstr = (char*)malloc(bytes+1);
memset(nstr, 0, bytes+1);
for(i = 0; i <= strlen(str)-strlen(find); i++){
flag = i;
k = 0;
for(j=i; j<=(i+strlen(find)-1); j++){
if(find[k] != str[j])
flag = -1;
k++;
}
if(flag != -1)
pos = flag;
}
int size = pos + strlen(replace) - 1;
int oldsize = pos + strlen(find);
int cont = 0;
j = 0;
for(i=0;i<=bytes-1;i++){
if(i>=pos && i<=size){
nstr[i] = replace[cont];
cont++;
if(i==size)
j=oldsize;
} else {
nstr[i] = str[j];
j++;
}
}
return nstr;
}
int main(){
char * reemplazo = strreplace("Texto & texto", "&", "&&");
printf("%s\n" ,reemplazo);
free(reemplazo);
return 0;
}
CitarReturn value
Type: LONG_PTR
If the function succeeds, the return value is the previous value of the specified offset.
#include <stdio.h>
#include <stdlib.h>
int arreglo[3][3], i, j, fila, columna;
int main(){
fila = 0;
columna = 0;
for(i = 0; i < 3; i++){
for(j=0;j<3;j++){
scanf("%d", &arreglo[i][j]);
}
}
for(i = 0; i < 3; i++){
for(j=0;j<3;j++){
fila += arreglo[j][i];
columna += arreglo[i][j];
}
}
printf("Suma de filas: %d\n", fila);
printf("Suma de columnas: %d\n", columna);
return 0;
}