language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* Editors: Kelsey McRae, Malachi Parks Section: CISC361-010 Assignment: Programming Assignment 3 Due Date: 10/8/2020 */ #include <stdlib.h> #include <dirent.h> #include <stdio.h> #include <string.h> #include <unistd.h> int list(char *dirName) { DIR *d; struct dirent *dir; if(dirName == NULL){//print curre...
C
#include <stdio.h> void main() { // For loops allow us ability to create a code block that runs multiple times + require an iterator variable. // For loops give the following functionality: // Initialize iterator varaible using initial value. // Check if the iterator has reached its final value. // ...
C
#include <stdio.h> #include <unistd.h> #include <signal.h> int n = 0; void signal_handler(int sig){ n++; n%2==0?printf("Père: %d ", n):printf("Fils: %d ", n); fflush(stdout); } int main(void){ pid_t fils = fork(); if (signal(SIGUSR1,signal_handler) == SIG_ERR){ perror("signal()\n"); ...
C
#include<stdio.h> struct testcases { unsigned int x, y, a; int result; } tests[] = { { 3, 7, 5, 2 }, { 23, 5, 7, 4 }, { 7, 31, 6, 1 }, { 321, 345, 71, 20 }, { 12345, 8765, 567, 324 }, //higher values of input { 0, 23, 6, 0 }, //if x is zero { 23, 0, 6, 1 }, //if y is zero { 6547, 876, 456, 1 }, { 2345...
C
#include <cs50.h> #include <stdio.h> int main(void) { //initalization int height; //get height from user within range of 1 to 8 do { height = get_int("Height: "); } while (height > 8 || height < 1); //make pyramid for (int row = 0; row < height; row++) { ...
C
#include <stdio.h> #include <stdlib.h> #include <getopt.h> #include <ctype.h> #include <string.h> #include <stdint.h> #include <math.h> int char_to_bits (const char c, uint8_t* bits); int bits_to_char(const uint8_t* bits); int string_to_bits(const char* string, uint8_t* bits); int bits_to_string(const uint8_t* bits, ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_atoi.c :+: :+: :+: ...
C
#include<math.h> #include<stdio.h> //constantes (pi / gravidade) #define g 9.80665 #define pi 3.14159 //var globais double h, h1, v, altura, angulo, vx, vy, queda; int n, p1, p2; //funções double seno(double angulo); double cosseno(double angulo); int main() { scanf("%lf...
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
#include<stdio.h> void main() { int n,r,a=0,v; printf("enter the n value"); scanf("%d",&n); v=n; while(n>0) { r=n%10; a=a*10+r; n=n/10; } if(v==a) { printf("palindrome"); } else { printf(" not palindrome"); ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct _VOICE_HISTORY_NODE_ { char * voice_url; struct _VOICE_HISTORY_NODE_ * prev; struct _VOICE_HISTORY_NODE_ * next; }VOICE_HISTORY_NODE; void create_list_head(VOICE_HISTORY_NODE ** head); void destory_list(VOICE_HISTORY_NODE ** head); void prin...
C
/* * Copyright (c) 2020 ETH Zurich. * All rights reserved. * * This file is distributed under the terms in the attached license file. * if you do not find this file, copies can be found by writing to: * ETH Zurich D-INFK, Universitaetstr. 6, CH-8092 Zurich. attn: systems group. */ #ifndef SLAB_ALLOCATOR_H_ #def...
C
#include <stdint.h> #include <math.h> #include "hlBlendOp.h" /*32 bits floating point blending*/ static float hl_b_mix_32b(float down, float up, float alpha){ return down*(1.0-alpha)+up*alpha; } static float hl_b_add_32b(float down, float up, float alpha){ return down + up*alpha; } static float hl_b_mult_32b(float ...
C
#include <stdio.h> int main() { int mesec,den,godina; printf( "Vnesi data vo oblik dd-mm-yyyy,dd/mm/yyyy ili dd+mm+yyyy: " ); scanf( "%d%*c%d%*c%d", &den, &mesec, &godina ); if(mesec == 1) { printf( "Vneseniot datum e %d januari %d godina.", den, godina ); } if(mesec == 2) { prin...
C
// This adds coalescing of free blocks. // Improves performance to 54/100 ... takes less time. /*------------------------------------------------------------------- * Malloc Lab Starter code: * single doubly-linked free block list with LIFO policy * with support for coalescing adjacent free blocks *...
C
#include <stdio.h> #include <math.h> #define MAX_SIZE 1000000 #define MAX_CO 1000 #define quadratic(n, a, b) ( (n * n) + (a * n) + (b) ) void populate_sieve(int upper, short bool_list[]){ int j; for(j = 0; j < upper; j++){ bool_list[j] = 1; } bool_list[0] = 0; bool_list[1] = 0; int test_int = 2; doub...
C
#include "fs.h" #include "x86.h" #include "types.h" #include "defs.h" // the superblock struct super_block spb = { 0x1111, {INODE_MAP_OFFSET,INODE_MAP_SIZE}, {INODE_ARRAY_OFFSET,INODE_ARRAY_SIZE}, {SECTOR_MAP_OFFSET,SECTOR_MAP_SIZE}, DATA_SECT }; // all the commands and there pointer to the function...
C
#include <stdio.h> #include "unix_sock.h" int main(int argc, char **argv) { char cmd[32] = {0}; if (argc < 2){ return 0; } snprintf(cmd, sizeof(cmd)-1, "%s", argv[1]); switch(cmd[1]){ case 'l': unix_sock_client_send(HNAP_MSG_SOCK_FILE, hnap_msg_event_log_start); ...
C
#include <stdio.h> #define MAXLINE 1000 int strindex(char s[], char t[]); int getline(char s[], int lim); int main(void) { char line[MAXLINE]; char term[] = "ould"; int lastOcc; while(getline(line, MAXLINE) > 0) if((lastOcc=strindex(line, term)) > 0) printf("%s %d\n", line, ...
C
#include<stdio.h> void main() { int sum=0,i,a[5]; printf("enter any 5 value\n"); for(i=0;i<5;i++) { scanf("%d",&a[i]); sum+=a[i]; } printf("sum of elements=%d\n",sum); }
C
#include <stdio.h> #include <string.h> #include <ctype.h> int judge(char); int main(int argc, const char *argv[]) { int i=0; int j=0,k=0,l=0; char buf[200]={0}; char buf2[200]={0}; printf("Enter a string:\n"); gets(buf); printf("The Original String is:\n"); puts(buf); for(j=strlen(bu...
C
/* ************************************ *ͨWindows API * ʾ * Event.c * 7.2.1 ʾʹEventͬ߳ **************************************/ /* ͷļ*/ #include <windows.h> #include <stdio.h> /* 塡*/ #define NUMTHREADS 3 #define BUFFER_SIZE 16 #define FOR_TIMES 5 /* ȫֱ*/ HANDLE hEvent; // ͬ BYTE lpSharedBuffer[16]...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <assert.h> int main(int argc, char const* argv[]) { int i, j; for (i = 1; i <= 9; i++) { for (j = 1; j <= i; j++){ printf("%d * %d = %d", j, i, i*j); } printf("\n\n"); } return 0;...
C
#include<Python.h> #include<numpy/arrayobject.h> #include<stdio.h> #include"PacWar.h" typedef signed char PacBits; static const int PACBIT_TYPE = NPY_BYTE; typedef unsigned int Score; static const int SCORE_TYPE = NPY_UINT; static const int GENE_LEN = 50; /* * Pacwar core * =========== */ /** * Run a single ...
C
/* common_execution.c * * Created on: Jul 8, 2014 * Author: root */ #include "common_execution.h" bool estadoPermisivo(state estado) { return (estado == NORMAL || estado == KILL_CPU); } void terminarProceso(void* datosExtra, t_size sizeExtra) { char* translate = string_itoa(estado); t_action accion = di...
C
#include <stdio.h> #include "ListaCircular.h" #include "ListaCircular.c" int remove_lista_inicio(Lista* li){ if(li == NULL) return 0; if((*li) == NULL) return 0; if((*li) == (*li)->next){ // so um um nó: a lista fica vazia free(*li); *li = NULL; return 1; } E...
C
#include "ns.h" extern union Nsipc nsipcbuf; void input(envid_t ns_envid) { binaryname = "ns_input"; // LAB 6: Your code here: // - read a packet from the device driver // - send it to the network server // Hint: When you IPC a page to the network server, it will be // reading from it for a while, so don't im...
C
/* * File: gregtojd.c * Author: glitchmaker * gregtojd: code to translate Gregorian date to Julian day * Created on August 18, 2014, 5:51 PM */ #include <stdio.h> #include <stdlib.h> double julian_centuries(double jd) { } double hms2deg(int h, int m, double sec){ return (9+((double)m/60)+((double) se...
C
#include<stdio.h> int main(int argc, char *argv[]) { int a,b,n,i,j; scanf("%d%d%d",&a,&b,&n); if((a*10+9)%b>9) printf("-1\n"); else { printf("%d%d",a,9-(a*10+9)%b); while(--n) printf("0"); printf("\n"); } return 0; }
C
#pragma once #include<iostream> #include "DataType.h" typedef struct stacknode{ DataType data; struct stacknode *next; }StackNode; typedef StackNode* LinkStack; LinkStack top; //п int StackEmpty(LinkStack top){ return top == NULL; } //ջ LinkStack Push(LinkStack top, DataType x){ StackNode *p; p = (StackNode*)...
C
//-------------删除字符串中的空格,空间复杂度常数级--------------- void delet_space(char *str) { int i = 0; //i下标始终指向下一个可用的空位 char * p = str; //p指针向后扫描 while(*p) { if(*p != ' ') //遇到空格时,i不动,p继续走。 str[i++] = *p; p++; } str[i]=‘\0’; } //-----------------en...
C
#include<stdlib.h> #include<stdio.h> #include<sys/socket.h> #include<netdb.h> #include<string.h> #include<unistd.h> #include<netinet/in.h> #include<arpa/inet.h> #include<assert.h> #define PORT 8900 #define BUFFER_SIZE 1024 int main(int argc, char **argv){ int fd; int check_ret; char send_buf[BUFFER_SIZE]; fd = s...
C
#include<stdio.h> #define MAX_STR_LEN 202 #define MAX_STR_LEN 102 char * str_cat(char * t, char * s) { int i,j; for(i = 0; t[i] != '\0'; i++) { ; } for(j = 0; s[j] != '\0'; j++) { t[i+j] = s[j]; } t[i+j] = '\0';/*将最后一项赋值\0*/ return t; } int main() { ...
C
/* * Video Lecture: 39 * Instructor: Arif Butt * Course: System Programming with Linux * hackplanetearth.c: The shell code prints a message on screen and exits * compile: gcc hackplanetearch.c * usage: ./a.out */ #include <stdio.h> #include <string.h> char *code = "\xeb\x1e\x5e\x48\x31\xc0\xb0\x01\x48\x89\xc7\x...
C
/******************************************************************************************** * Copyright (C) 2016/03/06 , Genvision * * File Name : bowling.c * File Mark : * Description : * Verision : 1.0 * Date : Mar 06, 2016 * Author : Peter Zhang * Email : zfy31415926.love...
C
#include<stdio.h> #include<stdlib.h> #define MAX 100 void push(int); void pop(); void display(); int arr[MAX]; int head=-1; int main() { int val,opt; while(1) { printf("enter option\n 0-exit\n 1-push\n 2-pop\n 3-display\n"); scanf("%d",&opt); switch(opt) { case 0: exit(0); case 1: printf("enter v...
C
#include <stdio.h> #include <stdlib.h> #define MEMORY_SIZE 4096 #define REGISTER_SIZE 16 // Exercice 1 typedef struct { unsigned char memory[MEMORY_SIZE]; unsigned char registers[REGISTER_SIZE]; unsigned char memory_register; unsigned char pc; } chip8; chip8* create(){ return malloc(sizeof(chip8)...
C
#include <stdio.h> #include <stdlib.h> int selectionSort(int *arr, int arrSize) { for (int i = 0; i < arrSize-1; i++) { int minimumIndex = i; for (int j = i; j < arrSize; j++) { if(arr[j] < arr[minimumIndex]) { arr[minimumIndex] = arr[j]; minimumIndex = j; } } int temp = arr[i]; arr[i] = ar...
C
#include <stdio.h> char line[10]; float width; float height; float perimeter; int main(void) { printf("Perimeter calculator\n"); //Title printf("Enter width: "); //input width fgets(line, sizeof(line),stdin); sscanf(line, "%f", &width);//scanning input printf("Enter height: "); //input height fgets(l...
C
#include<stdio.h> #include<string.h> #include<ctype.h> int main() { char a[100]; int i; int t; while(gets(a)) { t=strlen(a); putchar(a[0]-32); for(i=1;i<t;i++) { if(a[i-1]==' '&&isalpha(a[i])) { putchar(a[i]-32); } else putc...
C
#include <stdio.h> #include <string.h> int main(){ char num[30]; char novoNum[30]; int i, index; index = 0; printf("Informe o numero: "); gets(num); for(i = 0; i<strlen(num); i++){ if(num[i] != ','){ if(num[i] == '.'){ novoNum[index++] = ','; }else{ ...
C
/* fscanf 이용하기 */ #include <stdio.h> int main(){ FILE *fp = fopen("a.txt", "r"); char data[100]; if (fp == NULL){ printf("파일 열기 오류 \n"); return 0; } printf(" ----- 입력 받은 단어들 ----- \n"); /* scanf는 stdin 에서만 입력을 받지만 fscanf는 임의의 스트림에서도 입력을 받을 수 있는 좀 더 일반화 된 함수 f...
C
#include <stdio.h> #include <stdarg.h> #define DEBUG #ifdef DEBUG #define DEBUG_WRITE(arg) debug_write arg #else #define DEBUG_WRITE(arg) #endif #define SNAP_INT(arg) fprintf(stderr, #arg "..%d\n", arg) void debug_write(char *format, ...){ va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); ...
C
/** *flip_bits - returns the no. of bits needed to flip a digit to another *@n:no. to flip *@m:no. to flip into *Return:no. of bits to flip */ unsigned int flip_bits(unsigned long int n, unsigned long int m) { unsigned int count, i; count = 0; for (i = 0; i <= (sizeof(unsigned long int) * 8); i++) { if ((m ...
C
#include<stdio.h> #include<stdlib.h> // need to know the length of the array the first time the function is called // mergesort void mergesort(int arr[], int s, int e){ if (e-s > 1){ int split = (e-s)/2; int left[split]; int right[e - s - split]; for (int i = s; i < s+split; ++i...
C
#include <assert.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "../../../../../ffi-system-calls/ffi/include/codes.h" #include "../../../../../ffi-system-calls/ffi/include/marshalling.h" void ffitest_file_read_non_blocking(unsigned char *c, long clen, uns...
C
/* ************************************************************************** */ /* LE - / */ /* / */ /* init_segment.c .:: .:/ . .:: ...
C
/* ** sendresult.c for rtracer in /home/vasseu_g/rendu/MUL_2014_rtracer ** ** Made by Adrien Vasseur ** Login <vasseu_g@epitech.net> ** ** Started on Thu Jun 4 16:25:04 2015 Adrien Vasseur ** Last update Sun Jun 7 00:48:07 2015 Adrien Vasseur */ #include <stdlib.h> #include <stdio.h> #include "my.h" #include "n...
C
#include <stdio.h> #include <stdint.h> //#include <stdlib.h> uint16_t crc16_buypass(unsigned char *data, int len) { // c eh o estado // r eh o valor calculado // d eh o dado // s, p e t sao valores intermediarios uint8_t d, s, p; uint16_t c=0, r=0, t=0; int contador; for(contador=0; contador<len; contador++) ...
C
#include "holberton.h" #include <stdio.h> /** *_isdigit - check if is a digit. * * Return: Always 1 or 0. *@c : int character */ int _isdigit(int c) { if (c >= 48 && c <= 57) { return (1); } else return (0); }
C
#include <stdio.h> #include <stdlib.h> #include <signal.h> // Function for signal handling void signalHandler(int idSid) { if (idSid == SIGSTOP) { printf("SIGINT\n"); } else if (idSid == SIGKILL) { printf("SIGKILL\n"); } else if (idSid == SIGUSR1) { ...
C
//////////////////////////////////////////////////////////////////////////////// // Main File: intdate.c // This File: division.c // Other Files: sendsig.c division.c // Semester: CS 354 Spring 2019 // // Author: Mo Felonda // Email: felonda@wisc.edu // CS Login: ...
C
/* Напишите программу, которая читает целые числа до тех пор, пока не встретится число 0. После прекращения ввода программа должна сообщить общее количество введенных четных целых чисел (за исключением 0), среднее значение введенных четных целых чисел, общее количество введенных нечетных целых чисел и среднее значени...
C
#include <stdio.h> #include <stdlib.h> #include <memory.h> #include "Comunica.h" // A function to check if a string str is palindrome void isPalindrome(char str[]) { // Start from leftmost and rightmost corners of str int l = 0; int h = strlen(str) - 1; // Keep comparing characters while they are sam...
C
#include<stdio.h> int main() { int i,j; for(i=69;i>=65;i--) { for(j=65;j<=i;j++) { printf("%c",j); } printf("\n"); } return 0; }
C
#include "stdio.h" int main(void) { float base, altura, area; printf("Digite o valor da base: "); scanf("%f", &base); printf("Digite o valor da altura: "); scanf("%f", &altura); area = (base * altura) / 2.0; printf("\nValor da area: %.1f", area); return 0; }
C
#include <stdio.h> enum varun { varun1 = 1, varun2 = 2 }; int main(void) { int b = 10; enum varun var = varun1; while (1) printf("\nVarun\n"); int a; }
C
#include <stdio.h> #include <stdlib.h> int main() { int *ptr, *ptr1; int n, i, sum=0; printf ("Enter the number of elements:\n"); scanf ("%d", &n); ptr = (int*)malloc(n * sizeof(int)); ptr1 = (int*)calloc(n,sizeof(int)); if (ptr == NULL || ptr1 == NULL) { printf ("Memory not allo...
C
/* * File: rtcmcap.c * Description: Main project file */ #include <stdlib.h> #include <stdio.h> #include <stdarg.h> #include <string.h> #include <signal.h> #include <time.h> #include <errno.h> #include "rtcmcap.h" #include "receiver.h" #include "sender.h" FILE *log_file; FILE *debug_file; volatile unsigned char st...
C
#pragma once #include <minunit.h> #include <mdv_eventfd.h> #include <stdint.h> MU_TEST(platform_eventfd) { mdv_descriptor fd = mdv_eventfd(true); mu_check(fd != MDV_INVALID_DESCRIPTOR); uint64_t data[] = { 1, 2, 3 }; size_t len; mdv_errno err; for (size_t written = 0; written < sizeof data;...
C
/*Works on https://www.onlinegdb.com/ (aqui fue donde lo hice y probe) Agregar tambien el archvo .h para que funcione Primero debes de poner la fila y despues la columna (separados de un espacio) like : 3 4 El tamaño del board ya esta definido y es de 10x10 */ #include <stdio.h> #include <math.h> #include <stdlib.h...
C
#include <stdlib.h> #include <stdio.h> void matmulNaive(const double* const restrict a, const double* const restrict b, double* const restrict res, const size_t size){ for (size_t i = 0; i < size; ++i){ for (size_t j = 0; j < size; ++j){ res[i*size + j] = 0; for (size_t k = 0; k < size; ++k){ res[i*size +...
C
#include<stdio.h> struct bitfield { signed int a:1; signed int b:32; unsigned c:32; //float d:4; // Bit fields can only be taken for integer types (chat, short, int, long int, long long int - signed and unsigned) //char e:5; }bf; int main() { bf.a = 1; //Signed numbers are stored in 2s complement form. bf.b =...
C
#if !defined(KBUFFER_H) #define KBUFFER_H #include <linux/ioctl.h> // 218 == 0xda #define KBUFFER_MAJOR_NUMBER (218) // a sruct to pass in som econtext info // not really used. just wanted to see how this works struct kbuffer_ctx { int foo; int bar; }; // define two ioctl numbers // one to get the current str...
C
#include<stdio.h> #include<stdlib.h> struct node { int index; struct node *next; struct node *front; }; int printNode(struct node *toprint) { printf("%i<->\n",toprint->index); //printf("%i<-%i\n",toprint->front->index,toprint->index); return 0; } int foreach(struct node *link,int (* func)(struct node *todo)) { s...
C
#include "binary_trees.h" #include <stdio.h> #include <stdlib.h> /** * heap_insert - inserts a value into a Max Binary Heap * @root: Pointer to the root node * @value: Integer stored in the node * Return: created node */ heap_t *heap_insert(heap_t **root, int value) { heap_t *node, *current, *left, *right; int ...
C
// // The C Programming Language // Brian Kernighan & Dennis Ritchie // Chen Chen @ August 4th, 2015 // #include <stdio.h> unsigned invert(unsigned x, int p, int n) { return x ^ (~(~0 << n) << (p + 1 - n)); } int main(int argc, char *argv[]) { unsigned a = 1251; printf("a = %u\nnew a = %u\n", ...
C
#include <stdio.h> #include <stdlib.h> // Stack type struct Stack { int top; unsigned capacity; int* array; }; // Stack Operations struct Stack* createStack( unsigned capacity ) { struct Stack* stack = (struct Stack*)malloc(sizeof(struct Stack)); if (!stack) return NULL; stack->top =...
C
#include "unhideInformation.h" #include "hideInformation.h" #include <stdbool.h> BMP* receiveSourceImage(char file[]){ BMP *src_img = bmp_read (file); //check if the image is ok to use if (bmp_compression(src_img) != BI_RGB) { fprintf(stderr, "Error: the image is compressed\n"); exit(EXIT_FAILURE); //Íd...
C
#include "graphics.h" static DMA2D_HandleTypeDef dma2dHandle; uint16_t hsv2rgb565(uint16_t h, uint8_t s, uint8_t v){ uint8_t r, g, b; if((h>359)||(s>100)||(v>100)) return 0; if(h<61){ r=255; g=(425*h)/100; b=0; }else if(h<121){ r=255-(425*(h-60))/100; g=255; b=0; }else if(h<181){ r=0; g=255; b=...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct {//estrutura de dados para salvar a imagem PGM unsigned char maximo;//Valor mximo que um pixel pode assumir unsigned char **dados;//Matriz para guardar os valores de cada pixel int c;//comprimento da imagem em pixels (nmero de...
C
#include <stdio.h> #include <stdlib.h> #include<math.h> // Necessaria pras funções matematicas como sqrt e pow. /* Victor Hugo Faim victorfaim@hotmail.com Faça um programa que receba dois números e execute uma das operações listadas a seguir, de acordo com a escolha do usuário. Se for digitada uma opção inválida, mo...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/wait.h> #include <fcntl.h> #define CREATE_FLAGS (O_WRONLY | O_CREAT | O_APPEND) #define CREATE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) char *cmd2[] = {"grep","e", NULL}; char *cmd1[] = {"tail","-5", "/etc/passwd", NULL}; int main(void) { ...
C
/** * See Copyright Notice in picrin.h */ #include <picrin.h> #include "value.h" #include "object.h" KHASH_DEFINE(dict, struct symbol *, pic_value, kh_ptr_hash_func, kh_ptr_hash_equal) pic_value pic_make_dict(pic_state *pic) { struct dict *dict; dict = (struct dict *)pic_obj_alloc(pic, PIC_TYPE_DICT); kh_in...
C
/* * File System - Test file */ #include <string.h> #include "file_system.h" #define BUFFER_SIZE (255) int main(int argc, char *argv[]) { char path_name[BUFFER_SIZE] = {0}; int length = strlen(argv[1]); memcpy(path_name, argv[1], length + 1); FindByPath(path_name); return (0); } /*unsigne...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* verif_if_param_exist.c :+: :+: :+: ...
C
#include "veclib.h" //function to difference of 2 vectors vector vec_c; float* diff(vector vec_a, vector vec_b){ for(int i=0;i<DIM;i++){ vec_c[i]=vec_a[i]-vec_b[i]; } return vec_c; }
C
#include "estrutura.h" /** * Identificação do nível hierárquico do funcionário. * Nível = distância do topo da hierarquia (ou seja, do presidente). */ double nivelH(funcionario func[], int ind){ if(func[ind].indChefe<0){ if (!func[ind].nivel) func[ind].nivel=1; return 1; //O presidente tem nível 1. } el...
C
/* AUTHOR : 2125_ANKIT PROGRAM: STACK USING ARRAY HEADER FILE DATE CREATED: SEPT 2021 DATE MODIFIED: SEPT 2021 */ #include<stdbool.h> #ifndef STACK_H #define STACK_H typedef int eleType; //DATA ...
C
#include<stdio.h> int main(int argc,char *argv[]){ printf("Program name %s\n",argv[0]); if(argc==2){ printf("The argument supplied is %s\n",argv[1]); }else if(argc>2){ printf("To many arguments supplied\n"); }else{ printf("One argument expected"); } }
C
#include <stdio.h> int main(){ int f; float c; printf("Enter the temp in F \n"); scanf("%d", &f); c=(5*(f-32))/9; printf("the Temp in C is %f \n", c); return 0; }
C
/* U datoteci duzi.txt se nalazi spisak duzi zadat tackama. Format datoteke je takav da je najpre zadat broj duzi, a pitom u svakom narednom redu duz u vidu cetiri koordinate: Ax Ay Bx By (tipa float). Potrebno je ucitati duzi iz datoteke, sortirati ih opadajuce prema njihovoj duzini i ispisati tako sortirani niz na st...
C
#include "sdl_base.h" // ---- Tools histogram void init_hist(SDL_Surface *image_surface, size_t w, size_t h, float *hist) { Uint8 r, g, b; for(size_t i = 0; i < w; i++) { for(size_t j = 0; j < h; j++) { Uint32 pixel = get_pixel(image_surface, i, j); SDL_GetRGB(pixe...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* char_manager.c :+: :+: :+: ...
C
#include "holberton.h" /** * print_octal - prints octal number * @vl: Integer * Return: int */ int print_octal(va_list vl) { unsigned int n = va_arg(vl, unsigned int); int i = 0, j; int arr[128]; if (n == 0) { _putchar('0'); return (1); } while (n != 0) arr[i++] = n % 8, n /= 8; for (j = i - 1...
C
// header files #include <stdio.h> #include "MetaDataAccess.h" /* Function Name: main Algorithm: driver function to test metadata uplaod Precondition: none Postcondition: returns zero on suzzess Exceptions: none Nontes: demonstrates development and use of metadata file uplad */ int main( int argc, char **argv )...
C
#include "constants.h" #include "sem.h" int tas(volatile char *lock); void sem_init(struct sem *s, int count) { s->count = count; s->lock = 0; // unlock int i; // zero pstatus and pids for (i = 0; i < NUMPROC; i++) { s->pstatus[i] = 0; s->pids[i] = 0; } } int sem_try(struct sem *s) { int ret; while (tas(...
C
#include <stdio.h> //룯 #include <stdlib.h>//ڴ亯 #include <string.h>//ַ #include <time.h>//ʱĺ int zhengshu(char string[]) { int value1=0; int i=0; while( string[i] >= '0' && string[i] <= '9' && string[i]!='.' ){ value1 *= 10; value1 += string[i] - '0'; i++; } ...
C
/* ** send_file.c for commun in /Users/leandr_g/Documents/Shared folder/testServer/commun/ ** ** Made by Gaëtan Léandre ** Login <leandr_g@epitech.eu> ** ** Started on Sun May 8 03:45:09 2016 Gaëtan Léandre ** Last update Sat May 21 23:45:44 2016 Philippe Lefevre */ #include "server.h" char *reciv_file(SOCKET ...
C
#include <stdio.h> int main(void) { char letter; printf("Enter a letter : "); scanf_s("%c", &letter,sizeof(letter)); for (int n = 0; n < 5; n++) { int j; for (int m = 0; m < 4-n; m++) { printf(" "); } for ( j = 4; j > 4 - n; j--) { printf("%c", letter - j); } for (;j<=4;j++) { printf("%c...
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 _POSIX_C_SOURCE 200112L #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <pthread.h> #include <codaCassa.h> #include <util.h> /* file di implementazione dell'interfaccia per la bounded queue della cassa */ /*-----------------------------------FUNZIONI DI UTILITA'----------------------------...
C
//Zadanie AL 7.4 #include <stdio.h> #include <stdlib.h> //Struktura wezla z ktorych zbudowane jest drzewo struct Wezel{ int wartosc; struct Wezel *lewy; struct Wezel *prawy; struct Wezel *rodzic; int licznik; }; //Funkcja sprawdzajaca czy dany element istnieje int liczenie(struct Wezel *drzewo, int element){ stru...
C
/* Escreva um vetor que leia um vetor G de 20 elementos caracter que representa o gabarito de uma prova. A seguir, para cada um dos 50 alunos da turma, leia o vetor de respostas (R) do aluno e conte o número de acertos. Mostre o no de acertos do aluno e uma mensagem APROVADO, se a nota for maior ou igual a 6; e mostre ...
C
#include <stdio.h> #include <sys/socket.h> #include <stdlib.h> #include <netinet/in.h> #include <sys/types.h> #include <unistd.h> #include <strings.h> #include <string.h> #include <sys/un.h> #define MAXLINE 1000 void str_cli(FILE *fp, int sockfd) { int n; char sendline[MAXLINE], recvline[MAXLINE]; ...
C
/* ** 这个文件包含由解析器调用的C代码例程来处理UPDATE语句 */ #include "sqliteInt.h" #ifndef SQLITE_OMIT_VIRTUALTABLE /* 前置声明*/ static void updateVirtualTable( Parse *pParse, /* 解析上下文 */ SrcList *pSrc, /* 需要修改的虚拟表 */ Table *pTab, /* 虚拟表的建立 */ ExprList *pChanges, /*处理 UPDATE 语句中的列变化 */ Expr *pRowidExpr, /* 定...
C
#include<stdio.h> int min(int x, int y, int z){ if(x < y && x < z){ return x; }else if(y < z){ return y; }else{ return z; } } int minEditDist(char str1[], char str2[], int m, int n){ int table[m+1][n+1]; for (int i = 0; i <= m; i++){ for (int j = 0; j <= n; j++)...
C
#include <stdio.h> void hanoi(int n ,char sorce,char assist,char target); // ϵӣͨŲϣʾΪףң // //Ƚһn-1ӣS,ͨT,ŲAϣ //ȻһӴS,ŲTϣ //ٽn-1ӴAͨSŲT void hanoi(int n ,char sorce,char assist,char target) { if(n) { hanoi(n-1,sorce,target,assist); printf("%d:%c->%c\n",n,sorce,target); hanoi(n-1,assist,sorce,target); } } int main(...
C
#include <string.h> #include <stdio.h> #include <sys/socket.h> #include <arpa/inet.h> #include <unistd.h> int main(int argc, char *argv[]) { int sockfd; struct sockaddr_in servaddr; inet_pton(AF_INET, "127.0.0.1", &servaddr.sin_addr.s_addr); servaddr.sin_family = AF_INET; servaddr.sin_port = htons(9999);...
C
# include <stdio.h> # include <math.h> int main () { double a,b,c,s,area; a=3.67; b=5.43; c=6.21; s=(a+b+c)/2; area=sqrt(s*(s-a)*(s-b)*(s-c)); printf ( "area is %f",area); return 0; }