language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #define STACK_CAPACITY 2 #define N 5000 struct Stack { char top; unsigned capacity; char* array; }; struct Stack* createStack() { struct Stack* stack = (struct Stack*)malloc(sizeof(struct Stack)); stack->c...
C
//program to reverse a string #include <stdio.h> #include <string.h> void reverse(char *s){ int i,j,c; for(i=0,j=strlen(s)-1;i<j;i++,j--){ c = s[j]; s[j] = s[i]; s[i] = c; } } int main(){ char s1[] = "ashok"; reverse(s1); printf("%s",s1); }
C
#include "lists.h" /** * insert_dnodeint_at_index - inserts a new node at a given position * @h: points at beginning of linked list * @idx: index at which to insert new node * @n: data to be entered into new node * Return: pointer to new node or NULL if it failed or * if index idx does not exist */ dlistint_t *...
C
/*=========================================================================== a <- PCOEFF(A,i) Polynomial coefficient. Inputs A : a polynomial in r variables, r >= 1; i : a non-negative BETA-digit. Output a : the coefficient of x^i in A, where x is the main variable. ==================================...
C
//count the elemnts how many time present in array void count(int[],int,int); #include<stdio.h> main() { int arr[50],i,size,elm; printf("enter size of an array\n"); scanf("%d",&size); printf("enter values in array\n"); for(i=0;i<size;i++) { scanf("%d",&arr[i]); } printf("enter element which you want to search...
C
// // Created by Rob Edwards on 8/5/19. // Test whether a file is gzip compressed and return 1 (true) for compressed and 0 (false) for uncompressed // #include <stdio.h> #include <stdbool.h> #include "is_gzipped.h" bool test_gzip(char* filename) { FILE *fileptr; char buffer[2]; fileptr = fopen(filename, ...
C
/* * * Copyright (C) 2015-2016 Du Hui * */ #include <stdio.h> #include <string.h> #include <time.h> #include <stdlib.h> #include "tag_list.h" #include "log.h" /* void free_tag(tag_list * tl, int i) { if (i < 0 || i > tl->size) { return; } free(tl->tags[i].tag); free(tl->tags[i].value); ...
C
#include <stdio.h> #include <math.h> #define N 4 void getdata(char* PC, char* PR) { int i = 0; *(PR+1) = *(PC+1); for (i = 2; i < N+1; i++) { *(PC + i ) = (*(PR+ i )) ^ (*(PC + i-1)); } } double data_del(char* PC) { int i = 0; double ret = 0.0; for (i = 1; i < N+1; i++) { ret =ret+ (*(PC + i)) * (pow(2.0...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line.h :+: :+: :+: ...
C
#include <pebble.h> #include "loading.h" static Window *loading_window; TextLayer *loading_text; TextLayer *status_text; char loading_status_buffer[32]; static void loading_window_load(Window *window) { Layer *window_layer = window_get_root_layer(window); GRect bounds = layer_get_bounds(window_layer); loadin...
C
extern void __VERIFIER_error(void); extern void __VERIFIER_assume(int); void __VERIFIER_assert(int cond) { if (!(cond)) { ERROR: __VERIFIER_error(); } return; } int __VERIFIER_nondet_int(); void main() { int i,h; int x; i=1; h=1; __VERIFIER_assume(x>=0); while (i < x) { h=2*h...
C
#include<stdio.h> int main(void) { int number[5], sum=0; for(int i=0;i<5;i++) { scanf("%d", &number[i]); sum+=number[i]*number[i]; } printf("%d\n", sum%10); return 0; }
C
#include <stdio.h> #include <string.h> int checkParadox(int n, int arr[n][2], int statements[n][2], int index, int truthValue){ if (arr[index][0] == 1) { if (truthValue != arr[index][1]) { return 1; } else{ return 0; } } else{ arr[index][0] = ...
C
#include "libft.h" #include <stdlib.h> t_list *ft_lstnew(void const *content, size_t content_size) { t_list *newl; if (!(newl = (t_list *)malloc(sizeof(*newl)))) return (NULL); if (content == NULL) { newl->content = NULL; newl->content_size = 0; } else { if (!(newl->content = malloc(sizeof(content)))) ...
C
/* Compiler: gcc */ /* CFLAGS=-Wall -xc -g */ #include <stdio.h> #include <stdlib.h> #include <errno.h> #define MAX_SIZE 100 void get(int **a, int **b); void sort(int *a, int l); void number(int **b); void die(const char *message); int main() { int *a = NULL; int *b = NULL; get(&a, &b); if (a == ...
C
// // Created by nik on 18.07.19. // #ifndef KICKASS_MATH_H #define KICKASS_MATH_H #define MIN(A, B) ((A) > (B) ? (B) : (A)) #define MAX(A, B) ((A) < (B) ? (B) : (A)) #define MEDIAN(A, B, C) (\ (A) > (B) \ ? ( (B) > (C) ? (B) : MIN(A, C) ) \ : ( (B) < (C) ? (B) : MAX(A, C) )) #define MAKE_MIN(A, B) A ...
C
/* * @Author: Cristi Cretan * @Date: 27-04-2019 19:36:27 * @Last Modified by: Cristi Cretan * @Last Modified time: 10-05-2019 16:51:30 */ #ifndef __HELPERS_H__ #define __HELPERS_H__ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> #include <stdbool.h> #define MEMERROR "Memo...
C
#include <stdio.h> typedef struct _building { int room[3]; } building_t; int build_room() { building_t mybu; building_t *pb; pb = &mybu; pb->room[0] = 100; pb->room[1] = 200; pb->room[2] = 300; printf("%d\n", mybu.room[0]); printf("%d\n", mybu.room[1]); printf("%d\n", mybu.ro...
C
// __ __ __ ____ __ ____ ____ ____ // ( ) / \ / \( _ \( ) ( __)/ ___)/ ___) // / (_/\( O )( O )) __// (_/\ ) _) \___ \\___ \ // \____/ \__/ \__/(__) \____/(____)(____/(____/ // ___ ____ __ _ ____ ____ __ ____ __ ____ __ ____ // / __)( __)( ( \( __)( _ \ / _\(_ _)/ \( ...
C
#include <kos.h> #include <png/png.h> // For the png_to_texture function #include <stdlib.h> // srand, rand #include <time.h> // time // Texture pvr_ptr_t pic; // To store the image from pic.png uint16_t dim = 8; uint8_t hardware_crop_mode = 0; // 0 for no cropping, 2 for keep inside, 3 for keep outside...
C
#include<stdio.h> #include<stdlib.h> typedef struct tableau{ int* tab; int maxTaille; int position; }Tableau; void ajouterElement(int a,Tableau *t){ t->tab[t->position]=a; t->position++; } Tableau* initTableau(int maxTaille){ Tableau* t = (Tableau*)malloc(sizeof(Tableau)); t->position=0; t->maxTaille=maxTail...
C
#include <stdio.h> void itob(unsigned int s); unsigned getmask(int p, int n); int main() { unsigned int c = 0xFF; // for (int i=0;i<8;i++){ // c =c << 1; // itob(c); // } unsigned int res = getmask(5,3); itob(res); // for (int i=0;i<3;i++){ // res =res << 1; // ...
C
#include <stdio.h> #include <stdlib.h> #include "SGD.h" int sgd_init(SGD *this, double lr) { this->lr = lr; return 0; } int sgd_update(SGD *this, double *param, double *grad, int size) { int i; for (i=0;i<size;i++) { param[i] -= this->lr * grad[i]; } return 0; }
C
#include"hash.h" #include<stdio.h> #include<stdlib.h> int main( ) { HashTable H; Position p; int i, k = 1, j = 0; H = create_table(13); for( i = 0; i < 400; i++, j += 71 ) { insert(j, H); } for( i = 0, j = 0; i < 400; i++, j += 71 ) { p =...
C
#include <stdio.h> #include <string.h> #include <unistd.h> #include <stdlib.h> #include <arpa/inet.h> #include <netinet/in.h> #include <netdb.h> #define PORT 80 #define MAXLINE 750 int main(int argc, char *argv[]) { char * url = {0}; struct hostent *host; struct in_addr h_addr; if(argc != 2) { ...
C
#include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <semaphore.h> #define CREATE_PROCESS 5 sem_t semaphore; void* routine(void* args) { sem_wait(&semaphore); sleep(1); printf("Hello from process %d\n", *(int*)args); sem_post(&sem...
C
// Accept a string from user and toggle the case. #include<stdio.h> #include<string.h> void ToogleCase(char *s) { int i=0; for(i=0;s[i]!='\0';i++) { if(s[i]>='a' && s[i]<='z') { s[i]=s[i]-32; } else if(s[i]>='A' && s[i]<='Z') { s[i]=s[i]+32...
C
#include <time.h> #include <math.h> #include <string.h> #include "xs/xs1024.h" uint64_t splitmix64(uint64_t seed) { uint64_t z = (seed += UINT64_C(0x9E3779B97F4A7C15)); z = (z ^ (z >> 30)) * UINT64_C(0xBF58476D1CE4E5B9); z = (z ^ (z >> 27)) * UINT64_C(0x94D049BB133111EB); return z ^ (z >> 31); } void splitmix...
C
#include<stdio.h> #define P1(a,b) printf("a#cc",#a,a); printf("%d:%d\n",a,a); #define P2(a, b) do{;printf("%d\n",a);printf("%d\n",b);}while(0) #define Cat(a,b) a##b int main(){ int n = Cat(123,15); printf("%d",n); }
C
// // T40-combination-sum-ii.c // algorithm // // Created by Ankui on 5/23/20. // Copyright © 2020 Ankui. All rights reserved. // // https://leetcode-cn.com/problems/combination-sum-ii/ #include "T40-combination-sum-ii.h" /** * Return an array of arrays of size *returnSize. * The sizes of the arrays are return...
C
#include <unistd.h> #include <stdio.h> #include <sys/socket.h> #include <stdlib.h> #include <netinet/in.h> #include <string.h> #include <time.h> struct user_info{ // Store Current userID and its type char username[100]; char type; }; void send_msg_client(int sock_fd, char *str) // For Send messag...
C
#include<stdio.h> int main(void) { int num; scanf("%d", &num); int arrinput[num]; for (int i = 0; i < num; i++) { scanf("%d", &arrinput[i]); } int res = 0; int counterpos = 0; int counterneg = 0; for (int i = 0; i < num - 1; i++) { if (arrinput[i] <= arrinput[i + 1]...
C
#include <stdlib.h> struct A_2_8 { int *p; char b[5]; }; struct A_2_8 a; // Array int foo_2_8(int i) { a.b[5] = 'a'; if (!a.b[5] || i) ; return 0; } // Memory int bar_2_8(int i) { a.p = (int *)malloc(sizeof(int) * 5); a.p[5] = 'a'; if (!a.p || i) ; free(a.p); return 0; }
C
#include "character.h" #include <stdio.h> #include <stdlib.h> #include "SDL/SDL.h" #include "SDL/SDL_image.h" #include "SDL/SDL_mixer.h" #include "SDL/SDL_ttf.h" char animChar (charac c, SDL_Surface *screen, SDL_Event event, char whichDirection){ static int i=0, j=0; if (event.key.keysym.sym == SDLK_RIGHT) { j=...
C
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward d...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> int main() { int a[5] = { 1,22,34,56,91 }; int n = 0, b, c; scanf("%d", &n); b = a[n] / 10; c = a[n] % 10; if (a[n] < 10) { printf("one %d", c); } else if (b == c) { printf("tow %d\n", c); } else { printf("one %d one %d", b, c); } return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* functions.h :+: :+: :+: ...
C
#include <pthread.h> int in_critical; int e1; int e2; int n1; int n2; void* thread1(void *arg) { int tmp; e1 = 1; tmp = n2; n1 = tmp + 1; e1 = 0; assume (e2 != 0); assume (n2 == 0 || n2 >= n1); in_critical = 1; assert(in_critical == 1); n1 = 0; return NULL; } void* thread2...
C
#include "prototypes.h" long int my_strtol(const char *s, char **end, int base) { unsigned long int ret = my_strtoumax(s, end, base); if (ret > LONG_MAX) return ret - LONG_MAX - 1; return ret; } long long int my_strtoll(const char *s, char **end, int base) { unsigned long long int ret = my_strtoumax(s, end, b...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* sa_sb_ss.c :+: :+: :+: ...
C
/* Copyright (c) 2020 MrDave1999 (David Román) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publis...
C
// // Created by hujianzhe // #include "../../../inc/crt/math.h" #include "../../../inc/crt/math_vec3.h" #include "../../../inc/crt/geometry/line_segment.h" #include "../../../inc/crt/geometry/plane.h" #include "../../../inc/crt/geometry/sphere.h" #include "../../../inc/crt/geometry/aabb.h" #include "../../../inc/crt/...
C
//2、周围的点应该都满足条件1:最外一圈也必须考虑。(测试点3、5) //3、唯一的点:这个点的色素值只能在图像中出现一次。(测试点3、5) #include <stdio.h> #include <math.h> int f(int a,int b,int A[a][b],int i,int j,int t) { int sum=0; for(int k=i-1;k<=i+1;k++) { for(int l=j-1;l<=j+1;l++) { if(k==i&&l==j) continue; else if(abs(A[i][j]-A[k][l])<=t) return 0; ...
C
/* Figura 8.14: fig08_14.c Uso de getchar y puts */ #include <stdio.h> int main() { char c; /* variable para almacenar los caracteres introducidos por el usuario */ char enunciado[ 80 ]; /* crea un arreglo de caracteres */ int i = 0; /* inicializa el contador i */ /* indica al...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* sort_stacks.c :+: :+: :+: ...
C
/* Time complexity: O(n*2^n) Space complexity: O(n^2) Where 'n' is the length of the string */ // Function to check if string str[i..j] is a palindrome or not bool isPalindrome(string str, int i, int j) { while (i <= j) { if (str[i++] != str[j--]) { return false; } } ...
C
#include<stdio.h> #include<time.h> #include<stdlib.h> #include<math.h> typedef struct problem { int num1; int num2; int num3; }PROBLEM; int score=0; void MakeProblem(PROBLEM problems[]); void PrintfProblem(PROBLEM problems[]); void ModifyProblem(PROBLEM problems[]); void RespondProblem(PROBLEM...
C
#include<stdio.h> int main() { int weight,cost,number,totalweight,totalcost; printf("\n enter weight:"); scanf("%d",&weight); printf("\n enter cost:"); scanf("%d",&cost); printf("\n enter number:"); scanf("%d",&number); totalweight = (weight*number); totalcost = (cost*number); printf("%d,%d",total...
C
/******************************************************************************* TscrnExcelڶԽTscrnExcelеĽӿʵ *******************************************************************************/ #include "TExcel_Scrn.h" #include "TExcel.h" //------------------------------õͷʵ-----------------------...
C
#include <iostream> #include"../singleLink.h" using namespace std; /* y有两个循环单链表,链表头指针分别为h1和h2. 编写一个函数将h2连接到h1之后,并保持循环链表形式 */ void merge_circle(SingleLink<int> *&link_a, SingleLink<int> *&link_b) { Node<int> *head_a = link_a->head; Node<int> *head_b = link_b->head; while(head_a->next != link_a->head) { head_a = ...
C
#include "pilha.h" struct pilha { struct no * topo; }; Pilha * constroi_pilha(){ Pilha * p = (Pilha *)malloc(sizeof(Pilha)); if(p){ p->topo = NULL; } return p; } int pilha_vazia (Pilha * p){ return !p->topo; } int push(int i, Pilha *p){ struct no *novo = constroi_no(i); if(novo){ i...
C
/*#include <stdio.h> double min(double x, double y); int main(void) { double a, b; printf("enter two number to compare:"); scanf("%lf %lf", &a, &b); printf("lower is %lf.\n", min(a, b)); return 0; } double min(double x, double y) { return (x < y ? x : y); } */
C
#include "msp430fr6989.h" const unsigned char lcd_num[10] = { 0xFC, // 0 0x60, // 1 0xDB, // 2 0xF3, // 3 0x67, // 4 0xB7, // 5 0xBF, // 6 0xE0, // 7 0xFF, // 8 0xF7, // 9 }; const unsigned char lcd_small_num[10] = { 0xCF, // 0 0x06, // 1 0xAD, // 2 0x2F, // 3 0x66, // 4 0x6B, // 5 0x...
C
#define Graph Digraph /* Recebe um grafo conexo G com custos arbitrrios nas arestas e calcula uma MST de G. A funo armazena a MST no vetor parent, tratando-a como uma rvore radicada com raiz 0. / / O grafo G e os custos so representados por listas de adjacncia. A funo supe que a constante INFINITO maior que o custo de...
C
//tree stucture definition struct tree_node{ char string[STR_LEN]; long int size; char date[DAT_LEN]; struct tree_node* left; struct tree_node* right; }; typedef struct tree_node tNode;
C
/*! * @file main.c * @brief H-Bridge 13 Click example * * # Description * This example demonstrates the use of the H-Bridge 13 click board by * driving the motor connected to OUT A and OUT B, in both directions with braking and freewheeling. * * The demo application is composed of two sections : * * ## Appli...
C
/*! * @file * @brief */ #include <stdint.h> #include <stddef.h> #include "tiny_stack_allocator.h" #include "tiny_utils.h" #define max(a, b) ((a) > (b) ? a : b) #define define_worker(_size) \ static void worker_##_size(tiny_stack_allocator_callback_t callb...
C
#include<stdio.h> void readFile(char *fileName, int g[], int v[], int *pW, int *pN) { FILE *f=fopen(fileName, "rt"); if (f!=NULL) { int i; fscanf(f,"%d%d",pW,pN); // W N for(i=0;i<= (*pN)-1;i++) fscanf(f,"%d%d",&g[i],&v[i]); // Trong luong Gia tri fclose(f); } } int main() { /* W: tr...
C
/* * Program to demonstarte MPI Paralle I/O * create, write and read parallel file * Hitender Prakash * */ #include <stdio.h> #include <mpi.h> int main(int argc, char **argv){ int i; int rank; int size; int offset; int nints; int N=20; MPI_File fhw; MPI_Status status; MPI_Init(&argc, &argv); MPI_C...
C
#include<stdio.h> #include<string.h> #define MAX_SIZE 100 void removeDuplicates(char * string); void removeAll(char *string,const char toRemove,int index); int main() { char string[MAX_SIZE]; printf("Enter any String :"); gets(string) printf("String before removing duplicates: %s\n",string); removeDuplicates(string); p...
C
#include <netinet/in.h> #include <time.h> #include <strings.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <netdb.h> #include <stdlib.h> #include <netdb.h> #include <arpa/inet.h> #include <sys/wait.h> #define MAXLINE 4096 /* max text line length */ #define LISTENQ 1024 /* 2nd arg...
C
/* * Copyright (c) 2012, Alexander I. Mykyta * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditi...
C
#include<stdio.h> #include<math.h> #define MAX 1000000 long long tree[MAX*4]; int TN; void update(int idx, int val) { for(idx = TN+idx-1;idx>0;idx>>=1) tree[idx]+=val; } long long query(int l, int r, int idx, int val) { if(l==r){ return l; } if(val<=tree[idx*2]){ return query(l,(l+r)/2,2*idx,val); } else{ ...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> #include <string.h> //ջ /* 1.'(' ջ ')'ջ ջеһԪΪ-1 ԭcharַǴ0ʼ */ int longestValidParentheses(char * s) { int len = strlen(s); if (len == 0 || len == 1) return 0; int i = 0; int arr[len + 1]; int ret = 0; int count = 0; int top = -1; arr[++top] = -1; fo...
C
#include <stdio.h> #define A 3 #define B 5 #define PRINT printf("\n") #define PRINT1 printf("%d",A*B);PRINT #define PRINT2(x,y) printf("%d",x*y) int main(){ PRINT1; PRINT2(A+1,B+1); }
C
#include<stdio.h> int primo(int num) { int i; for(i=2;i<num;i++) { if(num%i==0) { return 0; } } return 1; } int main() { int op=1,num; while(op) { printf("\n digite o numero: "); scanf("%d",&num); if(primo(num)) { ...
C
/** ****************************************************************************** * @file lcd.h * @author William PONSOT * @version V1.0 * @date 23-June-2017 * @brief Functions to print on the LCD screen (UART communication) ***********************************************************************...
C
#include <stdlib.h> #include "queue.h" void init_queue(queue* q, int size) { q->size=size; q->array = malloc(sizeof(q_node)*(size)); for(int i=0;i<size;i++) { q->array[i].element = NULL; } q->front = 0; q->back = 0; return; } int empty(queue* q) { if((q->array[q->front].element==NULL) && (q->front==...
C
#include <stdio.h> #include <stdlib.h> int main() { unsigned char x = 0; FILE *inp = fopen("bit_3.dat", "r"); if (inp == NULL) return 0; fscanf(inp, "%hhx", &x); fclose(inp); FILE *out = fopen("bit_3.ans", "w"); if (out == NULL) return 0; unsigned char ans = (x >> 4) & 3; char result[4][3]...
C
//https://leetcode.com/problems/house-robber/ long long max(long long a,long long b) { if(a>b) return a; return b; } int rob(int* nums, int numsSize){ int n=numsSize,i; long long ppmax=0,pmax=0,cmax=0; for(int i=0;i<n;i++) { cmax=pmax; cmax=max(cmax,nums[i]+ppmax); ...
C
/* ECHOCLIENT.C ========== (c) Yansong Li, 2020 Email: liyansong.cs@gmail.com Simple TCP/IP echo client. */ #include <sys/socket.h> /* socket definitions */ #include <sys/types.h> /* socket types */ #include <arpa/inet.h> /* inet (3) funtions */ #inclu...
C
// Forward declaration of isBadVersion API. bool isBadVersion(int version); class Solution { public: int firstBadVersion(int n) { long int left = 1,right = n; if(isBadVersion(1)) return 1; while(1) { if(isBadVersion((right+left)/2)) right = (r...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> typedef struct stdinf { int line; int id; int mathscore; int infscore; }stdinf; int main() { int n, i,j,tmp1,tmp2,tmp3; scanf("%d", &n); stdinf std[1000]; for (i = 1; i <= n; i++) { std[i].id =std[i].line= i; scanf("%d %d", &std[i].mathscore, &std[i]...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* type.c :+: :+: :+: ...
C
//****************************************************************************** // www.ghostyu.com // // Copyright (c) 2017-2018, WUXI Ghostyu Co.,Ltd. // All rights reserved. // // FileName : json_format.c // Date : 2018-03-01 22:03 /...
C
#include <stdio.h> #include <string.h> #include "md5.h" #define MAX 1024 MD5_CTX md5; void MD5_Encap(unsigned char*, unsigned char*); void salt(unsigned char*, unsigned char*); void MD5_Encap(unsigned char *str1, unsigned char *str2) { int i; //初始化 MD5Init(&md5); //传入明文字符串以及长度 MD5Update(&md5, str2, strlen((cha...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include "wish.h" int interactive_mode() { int res; while (1) { // Reset everything for next loop. res = 0; printf("wish> "); command *c = get_input(); if (c =...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int arr_swap(float **arr1, float **arr2) { float *arr3; arr3 = *arr1; *arr1 = *arr2; *arr2 = arr3; } float scalar_mult_columns(float** a, int k1, int k2, int n) //pointer to 2-dimentional array, 2 columns that we wish to multiply, number of rows { int i;...
C
#include <stdio.h> #include <string.h> #include <stddef.h> #include <stdlib.h> #include <unistd.h> #include "mpi.h" main(int argc, char **argv ) { /* This is the Hello World program for CPSC424/524. Author: Andrew Sherman, Yale University Date: 1/23/2017 Credits: This program is based on a pro...
C
/* source code: cafeteria3.c author: Lukas Eder date: 17.11.2017 descr.: sortiert die Fileausgabe der Aufgabe Cafeteria mittels Bubblesort. */ #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> //Struct struct artikel_t { char name[31]; int kategorie; double preis; };...
C
/* Andrés Felipe Rincón - 1922840 Juan Camilo Randazzo - 1923948 */ #include <stdio.h> #include <string.h> #include <stdbool.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> /* nameFunction: includes arguments: array of chars * char returns: boolean purpose: Gets a word an...
C
h_float16 float2half(float x){ long *x_bytes; //uint32_t unsigned char e; //uint8_t long m; //uint32_t h_float16 y; y=0; x_bytes=&x; // (cast float into bit array "int32") e=*x_bytes>>23;//b30-23 m=*x_bytes&0x7FFFFFL;//23 bit if (*x_bytes&(1L<<31)) y=0x8000 ;//sig bit if (e>0x8E)...
C
#include<stdio.h> int main() { int i,j,n; printf("Enter integer: "); scanf("%d",&n); i=n; while(i>0) { j=0; while(j<i) { printf("%d, ",i+j); j++; } printf("\n"); i--; } return 0; }
C
#include <stdio.h> #include <setjmp.h> jmp_buf saved_location; int main (int argc, char **argv) { int jmpval = 0; jmpval = setjmp(saved_location); if (jmpval == 0) { printf("jmp_buf initialized successfully\n"); } else { printf("jump achieved: jmpval=%d\n", jmpval); return 0; } ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* check_field.c :+: :+: :+: ...
C
int main(){ double sum[100]; int a=1,b=2,c,d; int n,i,j[100],k; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&j[i]); } for(i=0;i<n;i++){ sum[i]=0; a=1; b=2; for(k=0;k<j[i];k++){ sum[i]+=100000*b/a; c=b; d=a+b; a=c; b=d; } printf("%.3lf\n",sum[i]/100000); } return 0; }
C
#include<stdio.h> #include<conio.h> int main () { int data[10],i,min,j,temp; int len_array = sizeof(data)/4; for (i=0; i < len_array; i++) { printf("Enter value for %d index: ",i); scanf("%d",&data[i]); } for ( i=0; i < len_array - 1; i++) { min = i; for (j= i+1; j < len_array...
C
/* * st_pwm.h * * Copyright STMicroelectronics Ltd. 2004 * */ #if ! defined(__ST_PWM_H) #define __ST_PWM_H /* * PWM register definitions. * * Two PWM module types are supported. They are named pwm_3 and pwm_4. * The postfixes 3 and 4 denote the number of capture/ compare units * contained in the pwm. * ...
C
#include "avl_tree.h" void init(Tree_t* t) { t->root = NULL; } void make(Tree_t* t, int val) { Node_t* temp = (Node_t*)malloc(sizeof(Node_t)); temp->key = val; temp->left = temp->right = NULL; t->root = insert(t->root, temp); } Node_t* insert(Node_t *root, Node_t* temp) { if(root == NULL) { root = temp; } ...
C
#include<stdlib.h> #include<stdio.h> #include<string.h> int main(){ //Declaracao de variaveis int inteiro = 0; float decimal = 0; int flag = 1; //Declaracao de String em C char nome_arquivo_saida[100] = "saida.txt"; //Declaracao de um arquivo FILE *arquivo; //ABRIR...
C
/* ** ** Main.c ** ** **********************************************************************/ /* Last committed: $Revision: 00 $ Last changed by: $Author: Lucas Balling $ Last changed date: $Date: $ ID: $Id: $ *********************************...
C
#ifndef SYSTEM_MD5_H #define SYSTEM_MD5_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include <Config.h> //////////////////////////////////////////////////////////// // MD5 Context struct //////////////////////////////...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* show_alloc.c :+: :+: :+: ...
C
#include <stdio.h> main() { int a = 10; int aho( int i) { return i*2 + a; } int boke( int j ) { return a; } int j; j = aho ( 10 ); printf("%d , a %d " , j ,a ); }
C
/* gen_maxflow_typedef.h == Type definitions for a directed graph for generators */ /* Implemented by Tamas Badics, 1991, Rutgers University, RUTCOR P.O.Box 5062 New Brunswick, NJ, 08903 e-mail: badics@rutcor.rutgers.edu */ #ifndef _GEN_MAXFLOW_TYPE_H #define _GEN_MAX...
C
//Este programa fue hecho por Judá Rodríguez(emdajhuda) el 22 de octubre del 2018. #include <stdio.h> //Aqui indico que voy a usar unar variable para inicializar la matriz. void inicializar(float l1, float l2, float l3, float l4, int n); //Para la función main daremos desde la terminal el archivo a ejecutar y el nombre...
C
#include <stdio.h> #include "helpers.h" int main() { int nums[] = {2, 7, 11, 15, 13, 26, 3, 5}; int target = 14; int* return_array = twoSum(nums, 8, target); print_result(return_array, 2); return 0; }
C
/* С�������ٶȱ��� �仯���ó����ϡ����� */ #pragma once #include <stdio.h> const float lowestSpeed = 200; const float highestSpeed = 350; struct wheelSpeed; void fitWheelSpeed(wheelSpeed &w); struct wheelSpeed { wheelSpeed() = default; explicit wheelSpeed(float f1, float f2) :left(f1), right(f2) { fitWhe...
C
#include <stdio.h> #include <string.h> int main() { char buf[100] = {"adib dzulfikar"}; printf("sizeof(buf): %d\n", sizeof(buf)); printf("strlen(buf): %d\n", strlen(buf)); printf("buf: %s\n", buf); }
C
#include "cub3d.h" #include "libft.h" int verif_info_resolution(char **tab, char *str, int nb) { int i; int verif; char *tab_cpy; i = 0; verif = 0; while (tab[i] != NULL) { tab_cpy = tab[i]; tab_cpy = skip_spaces(tab_cpy); if (ft_strncmp(tab_cpy, str, nb) == 0) { tab_cpy++; tab_cpy = skip_spaces...