Skip to content

Instantly share code, notes, and snippets.

View thinkphp's full-sized avatar
💭
If I have seen further it is only by standing on the shoulders of giants. Newton

Adrian Statescu thinkphp

💭
If I have seen further it is only by standing on the shoulders of giants. Newton
View GitHub Profile
@thinkphp
thinkphp / complex.c
Created September 28, 2026 07:22
Laborator1 Numere Complexe
/*
Numere complexe:
parte reala
parte imaginara
z1 = a + bi
z2 = c + di
unhde i^1 = -1
@thinkphp
thinkphp / clone_string.c
Created September 28, 2026 06:21
String Copy CLonare
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <string>//strcpy(sir1, sir2)
char* str_cpy(const char* src ) {
if(src == NULL) return NULL;
size_t len = sizeof( src ) + 1; //\0
@thinkphp
thinkphp / matrix-liniarizat.c
Created September 25, 2026 10:00
matrice liniarizata transpusa
/*
int **mat;
//mat = (int*)malloc(m * sizeof(int*));
//mat = [ptr1, ptr2, ptr3..]
for(int i = 0; i < lines; ++i) {
mat[i] = (int*)malloc(n * sizeof(int))
@thinkphp
thinkphp / Malloc-calloc-realloc.c
Created September 25, 2026 09:19
Malloc-calloc-realloc.c
/*
functia malloc(n * sizeof(int)) dimensiunea total in bytes , nu initializeaza (continut medefinit) alocare simpla
calloc(n, sizeof(int))
n = numarul de elemente, dimensiune per element , se initializeaza cu 0, cand ai nevoie de valori initiale cu 0
realloc(ptr, dimensiune_noua) , pointer existent, noua dimensiune total ,
pastreaza continutul vechi, restul este nedefinit, cand vrei sa redimensionezi un vector deja alocat.
@thinkphp
thinkphp / prob1.c
Created September 25, 2026 08:39
PRoblema 1 LAborator
#include <stdio.h>
//#include <malloc.h>
#include <stdlib.h>//malloc...
#define MAX_NUME 30
#define NR_NOTE 3
typedef struct {
char nume[ 30 ];//
@thinkphp
thinkphp / material.c
Created September 25, 2026 07:40
vector de pointeri de tip Material
#include <stdio.h>
#include <stdlib.h>
typedef struct {
char denumire[20];
char unit_mas[10];
float cantitate;
} Material;
@thinkphp
thinkphp / struct Student.c
Last active September 25, 2026 08:59
struct Student
#include <stdio.h>
#include <string.h>
#define SIZE 100
typedef struct Student {
char name[ 49 ];//0...49//ana ..asdasdasda sasdsasdkaskda;ksk asd;klasd;klask;lask;dask;d lasdkl;adks
int varsta;
float medie;
@thinkphp
thinkphp / parcurgere-ptr.c
Created September 25, 2026 06:53
traversal ptr
/*
1
2
0
0
4
5
vect[i] = {1,2,3,4,5,0,0};
@thinkphp
thinkphp / swap pe octeti.c
Created September 25, 2026 06:31
swap pe octeti
#include <stdio.h>
void swap(int *a, int* b) {
int temp = *a;
*a = *b;
*b = temp;
}
void swap2(void *a, void *b, int dim) {
#include <stdio.h>
#define MAX 20 //dimensiunea maxima a tabloului
int main(int argc, char const *argv[])
{
int a[ MAX ];//tabloul citit de la tastatura
int n, i;