language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <stdlib.h> #include "wm_config.h" #include "wm_regs.h" #include <reent.h> #include <string.h> #include <stdarg.h> int sendchar(int ch) { #if WM_CONFIG_DEBUG_UART1 tls_reg_write32(HR_UART1_INT_MASK, 0x3); if(ch == '\n') { while (tls_reg_read32(HR_UART1_FIFO_STATUS) & 0x3F); tls_reg_...
C
/* ** EPITECH PROJECT, 2017 ** init.c ** File description: ** blabla */ #include "my.h" char **double_tab(char *buffer, int size) { int j = 0; int i = 0; int count = 0; char **tab = malloc(sizeof(char *) * (size + 1)); int nb = 0; nb = my_strlen(buffer) / my_getnbr(buffer); while (buffer[j] != '\0') { tab[i...
C
#include <stdlib.h> struct point { int x; int y; }; int main() { int* a = (int*) malloc(4*sizeof(int)); int b; a[0] = 1; a[1] = 2; a[2] = 3; a[3] = 4; struct point* p = (struct point*) a; b = p[1].x; return 0; }
C
#include <math.h> #include "nric.h" double carlson_rf( double x, double y, double z ) { double alamb, ave, delx, dely, delz, e2, e3, sqrtx, sqrty, sqrtz, xt, yt, zt; const double ERRTOL = 0.0025, TINY = 1.5e-38, BIG = 3.0e37, C1 = 1.0/24.0, C2 = 0.1, C3 = 3.0/44.0, C4 = 1.0/14....
C
#include "demo.h" #include "sqlite3.h" #include <iostream> using namespace std; class SQL { public: int Run(const char *query, const char *dbName = "Sqlite_Test.db") { int rt = 0; try { //Testing //throw std::logic_error( "Test exception handling" ); sqlite3 *db; char *szErrMsg = 0; ...
C
#include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { char buf[] = "hello"; //strlen需要返回值,返回值就是字符串的长度 //从首元素开始,到结束符为止的长度,结束符不算(遇到'\0'结束) int len = strlen(buf); printf("len = %d\n", len); printf("sizeof(buf) = %lu\n", sizeof(buf)); //多了一个'\0'; char buf2[] = "\0hello"; len = strlen(buf2...
C
#include "Snake.h" Snake *initSnake( int gridWith ) { Snake *newSnake = (Snake*)malloc( sizeof( Snake ) ); if ( !newSnake ) { fprintf( stderr, "Out of memory\n" ); return NULL; } newSnake->pGrid = initGrid( 25 ); newSnake->head = NULL; newSnake->tail = NULL; newSnake->dir = DIR_RIGHT; newSnake->size = 0...
C
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. * File Name : user_led.c * Creation Date :28-04-2019 * Last Modified : Sun 28 April 2019 20:10:11 PM MDT * Created By : Harsimransingh and Yasir Shah * Description: header file to control on board leds * Functions: * led_control() to turn on board leds on or off bas...
C
#include <stdio.h> //#include <malloc.h> #include <string.h> #include <assert.h> #include <stdlib.h> #include "challenge_system.h" #define FREE_NULL(e) free((e)); (e)=NULL; #define ASSERT(test_number, test_condition) \ if (!(test_condition)) {printf("TEST %s FAILED\n", test_number); } \ else printf("TEST %s OK...
C
#include <msp430.h> #include <stdio.h> #include <stddef.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #ifndef RINGBUFFER_H__ #define RINGBUFFER_H__ /* forward declare the type */ struct ringbuffer; void rb_init(struct ringbuffer* rb); int rb_put(struct ringbuffer* rb, char *value); const char* rb_get...
C
/*Lab Test - Program that uses structures and functions to enter driver's licence information from standard input and display them to standard output Date: 12/4/18 Author: Louis Chavez */ #include <stdio.h> #define K 21 #define N 11 struct date_of_birth { int day; ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* execute.c :+: :+: :+: ...
C
/* ** EPITECH PROJECT, 2018 ** my_intlen ** File description: ** my_intlen */ #include "my.h" int my_intlen(unsigned int nb) { int i = 0; for (int j = 1; nb / j > 0; j *= 10) i++; return (i); }
C
/*init.c*/ #include "init.h" /* déclaration des tableaux de chaines de caractères statiques */ char* Type[] = {"FRUIT","LEGUME"}; char* Fruits[] = {"BANANE","KIWI","POIRE","POMME","ANANAS","DURIAN"}; char* Legumes[] = {"HARICOT","FENOUIL","POIREAU","AUBERGINE","COURGETTE","CAROTTE"}; char* Armes[] = {"EPLUCHEUR...
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> #include <pthread.h> #define MAXN 2 pthread_cond_t cond[MAXN]; pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; void * function(void * args) { pthread_mutex_lock(&mutex); printf("Waiting for a signal\n"); pthread_cond_wait(&cond[0], &mutex); printf("Got signal!\n"); pthread_mutex_unlock(&mute...
C
#include<stdio.h> //Ayush Sharma //Scholar id :2012105 int main() { char n[500]; printf("Enter the value\n"); scanf("%s",n); int i=0; int d1=0,d2=0; while(n[i]!='\0') { if(n[i]=='.') { d1++; if(n[i+1]!='\0') d2=1; } ...
C
#ifndef _INJECT_BUNDLE_H_ #define _INJECT_BUNDLE_H_ #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif #endif /*********************************************************************** * NAME * inject_bundle -- Inject a dynamic library or bundle into a * ...
C
#iclude<stdio> #nclude<stdlib.h> #include<unistd.h> #include<sys/types.h> #include<sys/wait.h> Int main() { int str[100] = {1,2,3,4,.....,100} int array[4]; FILE *f; f = fopen("input.txt" , "w"); FILE *f1; f1 = fopen("output.txt", "r"); int i,j,status int sum = 0; int sum2 = 0; int sum3 = 0; int sum4 = 0...
C
#include <stdlib.h> #include <stdio.h> struct Node { int data; struct Node *next; }; void printList(struct Node *n) { printf("Nodes: \n"); while (n != NULL) { printf("%d\n", n->data); n = n->next; } } void addNode(struct Node **n, int data) { /* n is a pointer to a pointer, head */ struct Node*...
C
#include <stdlib.h> #include <gtk/gtk.h> struct _MainWindow { GtkWidget *pWindow; GtkWidget *pVBox; GtkWidget *pEntry; GtkWidget *pButton; GtkWidget *pLabel; }; typedef struct _MainWindow MainWindow; void OnUpdate(GtkWidget *pEntry, gpointer data); int main(int argc, char **argv) { MainWindo...
C
/* * Copyright (C) 2017, Vector Li (idorax@126.com). All rights reserved. */ /** * This small program is to detect a singly linked list has a loop or not. */ #include <stdio.h> #include <stdlib.h> #include <stdbool.h> typedef struct list_s { int data; struct list_s *next; } list_t; static void show(list_t *he...
C
#include "foo.h" struct foo *g_foo_p = NULL; void *hold_thread(void *arg) { int r = 0; while (1) { r = rand() % 5; sleep(r); if (r % 2 == 0) { if (g_foo_p) { foo_hold(g_foo_p); fprintf(stderr, "count +1\n"); foo_read(g_foo_p);...
C
#include <stdio.h> #include <string.h> char a[10], b[10], c[10]; void encode() { int m, n, i, k, j; printf("\nEnter the message:"); scanf("%s", a); printf("\nEnter the crc value:"); scanf("%s", b); m = strlen(a); n = strlen(b); for (i = 0; i < n - 1; i++) { a[m + i] = '0'; } printf("\nHence the message after adding re...
C
/*Ŀx,y,zС*/ //3 2222 11 #include <stdio.h> int main(int argc, char *argv[]) { int x,y,z; scanf("%d %d %d",&x,&y,&z); if(x<y){ //x<y if(z<x) printf("%d %d %d\n",z,x,y);//z<x<y else if(y<z) printf("%d %d %d\n",x,y,z);//x<y<z else printf("%d %d %d\n",x,z,y);//x<z<y } else{ // y<x if(z<y) ...
C
/* * uss.c * algorithme esclave * -- UH maitre esclave */ #include <stdio.h> #include <stdlib.h> #include <malloc.h> #include "pvm3.h" #include "point.h" /* * programme esclave */ /* calcul enveloppe de 4 point */ void calcul_pointUH(pb_t *pb) { pb->pts1 = point_UH(pb->pts1); pb->type = PB_FUS; } /* * ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line.c :+: :+: :+: ...
C
/** * @file ada.c * @author Julien Esposito * @brief A Description of the most generic functions used by the * ADA. */ /******************************************************************************/ /******************************************************************************/ #include <stdarg.h> #include <std...
C
#include <stdio.h> void isprime(int n){ int i,count=0; for(i=1;i<=n;i++) if(!(n%i)) count++; if(count<3) printf("It is prime"); else printf("It is not prime"); } int main(){ int num,i; printf("Enter number: "); scanf("%d",&num); for(i=1;i<=num;i++) if(!(num%i)) ...
C
#include <stdio.h> int main(void){ char ch1, ch2; scanf("%c%c", &ch1, &ch2); // ΰ Է printf("[%c%c]", ch1, ch2); // Էµ return 0; }
C
// // main.c // Based On G.P in C // // Created by yogendra singh on 3/3/21. // Copyright © 2021 yadavboy. All rights reserved. // //Consider the following series: //1,1,2,3,4,9,8,27,16,81,32,243,64,729,128,2187... //This series is a mixture of 2 series – all the odd terms in this series form a geometric series an...
C
#ifndef __VECTOR_H__ #define __VECTOR_H__ //data type that has 3 floats in in. //typedef struct //{ //float x, y, z; //}vec3d; //typedef float vec3d[3]; //union typedef union { struct { float x, y; }; float v[2]; }Vector2D; typedef union { struct { float x, y, z; }; float v[3]; }Vector3D; #define ve...
C
#include "sum.h" int sum(int a[], int n) { if (n==0) return 0; else return (a[n-1])+sum(a,n-1); }
C
// ******************************************************* // // circBufT.c // // Support for a circular buffer of uint32_t values on the // Tiva processor. // P.J. Bones UCECE // Last modified: 15.8.2020 // // ******************************************************* #include "main.h" #include "circBufT.h" // *****...
C
#include <stdio.h> int main(void) { int i,sign; double sum=0; sign=1; /* //1-1/2+1/3-...-1/100 for(i=1;i<=100;i++) { sum=sum+sign*1.0/i; sign=-sign; //printf("%lf\n",sum); } */ //1/2-1/4+1/6-...-1/100 for(i=2;i<=100;i=i+2) { sum=sum+sign*1.0/i; sign=-sign; //printf(...
C
/* This programs collects the data of all text files into one text file. The files that are packed are deleted from mentioned directory. */ #include <stdio.h> #include<stdlib.h> #include<unistd.h> #include<fcntl.h> #include<dirent.h> #include<sys/types.h> #include<sys/stat.h> #include<string.h> struct...
C
#pragma once #include "als/als_math.h" struct MeshVertex { MeshVertex() = default; Vec3 position; Vec3 normal; Vec2 texCoords; Vec3 tangent; Vec3 bitangent; bool operator==(const MeshVertex &other) { return equals(this->position, other.position) && ...
C
#include <stdio.h> #include <stdlib.h> #define HIGH(X, W) ((X) >> (W >> 1)) //operator priority! #define LOW(X, W) ((X) & ((1 << (W >> 1)) - 1)) #define INDEX(H, L, W) (H << (W >> 1) | L) #define SQRU(W) (1 << (W >> 1)) #define CSIZE(U, W) (U >> (W >> 1)) #define POPU(u) do{ \ u = (0x55...
C
/***************************************************************************** * * File: cellpool.c * Author: Alex Stivala * Created: April 2009 * * Simple cell pool allocator. By allocating a big chunk of memory at * initialization time, we can just get one cell at a time from it * in a lock-free manner w...
C
#include <stdlib.h> #include<stdio.h> int Choose(int i,int map[21][21]) { int who = 1; int system(const char *string); while (1) { system("cls"); printf("\n\n1ʼϷ\n\n2˳Ϸ\n\nѡ"); scanf_s("%d", &i); if (i == 1) { DrawMap(map,who); } else if (i == 2) { exit(0); } else { system("cls"); ...
C
#include <stdio.h> int main() { int week,days,left; const int w_d=7; printf("if you want to end the program,enter 0.\n"); printf("please input the days:"); scanf("%d",&days); while(days>0){ week=days/w_d; left=days%w_d; printf("%d day(s) are/is %d week(s) and %d day(s).\n",days,week,left); printf("please ...
C
// Reordering a list of strings in alphabetical order using array of pointers #include <stdio.h> #include <stdlib.h> #include <string.h> void reorder(int n, char *x[]); int main() { int i,n=0; char *x[10]; printf("Enter each string on a separate line below\n\n"); printf("Enter END when finished\n\n"); // read i...
C
#include <stdio.h> #include <stdlib.h> typedef struct Node { int data; struct Node* next; } Node; void print_list(Node* head){ Node* current_node = head->next; printf("%d ", head->data); while (current_node != NULL){ printf("%d ", current_node->data); current_node = current_node->next; ...
C
#include <mpi.h> #include <stdio.h> int main(int argc, char **argv) { int myrank = 0; int size = 0; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &myrank); MPI_Comm_size(MPI_COMM_WORLD, &size); printf("Process Hello from %d (total %d)\n", myrank, size); MPI_Finalize(); return...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> void selct(char *items,int count); int main(void) { char s[255]; printf("Enter a string:"); scanf("%s",s); selct(s,strlen(s)); printf("The sorted string is :%s\n",s); return 0; } void selct(char *items,int count) { register int a,b,c; int exchange; char...
C
/*ͨλña8 3λõ ϸڿҪǡ */ #include <stdio.h> int main(void) { int nvar = 2; printf("%d %d\r\n", nvar, nvar<<3); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* koch.c :+: :+: :+: ...
C
#include <stdio.h> #include <math.h> struct Point { double X, Y; }; double distance(struct Point a, struct Point b){ return sqrt(pow(a.X-b.X, 2) + pow(a.Y-b.Y, 2)); } int main(){ struct Point A={1,10}; struct Point B={3,4}; printf("%.4f",distance(A,B)); }
C
#include "common.h" char *minWindow(char *s, char *t) { int left = 0; int right = 0; int start = 0; int window[256] = {0}; int needs[256] = {0}; int i = 0; int t_len = strlen(t); int needs_size = 0; for (i = 0; i < t_len; i++) { if (needs[t[i]] == 0) { needs...
C
int titleToNumber(char* s) { int sum = 0; for(int i = 0; s[i] != '\0'; i++) { sum = sum*26 + (s[i] - 'A' + 1); } return sum; }
C
#include <stdio.h> #include <stdlib.h> #include "calculadora.h" #include "Validador.h" int mostrarResultado(int x, int y, int sum, int res, int prod, float div, int facx, int facy); int main() { int x; int y; int option; int isuma; int iresta; int iproducto; float fdivision; int ifacto...
C
#include<stdio.h> struct node { struct node * link; int info; }; void reverse(struct node **head) { struct *prev=NULL; struct *cur=head; struct *after; while(cur!=NULL) { after=cur->link; cur->link=prev; prev=cur; cur=after; } }
C
#include <stdio.h> #include <cs50.h> #include <math.h> /*This program gives you back an exact number of coins depending on how much change you have. Please enter how much change is owed.*/ void Give_Change(int Change_Owed); /*Asks for owed change, converts from dollars to cents, rounds, then runs through Give change...
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <ctype.h> #include <string.h> #include <time.h> #include "hash_map.h" #define MAX_LINE 1000 typedef uint8_t byte; enum INSTRUCTION_TYPE { A_INSTRUCTION, C_INSTRUCTION, LABEL }; enum A_INSTRUCTION_MODE { A_VALUE, A_SYMBOL }; int16_t rom_address = 0; ...
C
/** ****************************************************************************** * @file bsp_usart.c * @version V1.0 * @date 2013-xx-xx * @brief õprintfڣضprintf ****************************************************************************** * @attention * * ʵƽ̨: F103-ָ STM32 * ̳ :http:...
C
#include <stdio.h> #include <stdlib.h> char* strcpy(char* dest, const char* src) { char* inicio = dest; while(*src) { *dest = *src; } *dest = '\0'; return inicio; } size_t strlen(const char* s) { size_t l = 0; while(*s) { l++; s++; } return l; } cha...
C
#include<stdio.h> char map[101][101]; char flag[101][101]; int queue[10000]; int main() { int n, m, k, i, j, v; int r, c, rc = 0; int head, tail; scanf("%d %d %d", &n, &m, &k); for (i=1; i<=n; i++) for (j=1; j<=m; j++) { map[i][j] = 0; flag[i][j] = 0; } for (i=0; i<k; i++) {...
C
#include<stdio.h> int main(){ int a =2,b=4; a=a+b; //a->6 b =a-b; //b->2 a = a-b; //a->4 return 0; }
C
#include<stdio.h> struct node { char c; struct node *next; }; struct node *create(struct node *head,char ch) { struct node *newRecord,*temp; newRecord=(struct node *)malloc(sizeof(struct node)); newRecord->c=ch; newRecord->next=NULL; temp=head; if(head==NULL) head=newRecord; else { while(temp->ne...
C
#include <stdio.h> #include <string.h> #include "WheelTimer.h" #include "LinkedListApi.h" void print_(char *str){ printf("%s\n", str); } void wrapper_print(void *arg, int arg_size){ char *str = (char*)arg; print_(str); } int main(int argc, char **argv){ timer_t *wt = init_wheel_timer(); //initialize wall cl...
C
// // ex02_Task3.c // Infor2_Exercise // // Created by 谭特 on 17/3/17. // Copyright © 2017年 谭特. All rights reserved. // #include <stdio.h> int isReverse(char A[], char B[]) { //check if one or two of them are empty if(A[0] == '\0' && B[0] == '\0'){ return 1; } if(A[0] == '\0' && B[0] != '\0...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* philo_bonus_print.c :+: :+: :+: ...
C
#include<stdio.h> #include<string.h> void main() { char s[30]; int i,count=0,l; printf("Enter the string:"); scanf("%s",s); l=strlen(s); for(i=0;i<l;i++) { if(isdigit(s[i])) { count++; } } if(count==l) printf("\nNumeric"); else printf("\n N...
C
/* * Class: CS 452 * Assignment: HW 3 * Author: Colby Blair * Date Due: February xxth, 2012 * * Comments: Works with AVR STK500 and an Atmega8515L (Atmege32 untested * yet). * */ #include <inttypes.h> #include <avr/io.h> #include <avr/pgmspace.h> #include <avr/interrupt.h> /*factor in which to scale d...
C
#include <stdio.h> int main () { int height; printf("plss enter your height"); scanf("%d", &height); if(height>182) { printf("you are eligible for sports"); } if(height==182) {printf("YOU CAN WATCH THE MATCH");} if(height<182) {printf("u can_t even see the match")...
C
#include <r.h> #include <stdio.h> #include <math.h> int main(void) { xorshift_state_initalize(); const size_t N = 1<<4; printf("vec_t unit_vectors(size_t i) { switch(i %% %zu) { ", 2*N*N); for(size_t i = 0; i < N; i++) { for(size_t j = 0; j < (N*2); j++) { float x = sin(M_PI*(i+1)/...
C
/************************************************************************ * * Compiler implementation for imperative programming language IFJ18 * * Autors: * Sasák Tomáš - xsasak01 * Venkrbec Tomáš - xvenkr01 * Krajči Martin - xkrajc21 * Dižová Natália - xdizov00 * ****************************************...
C
#pragma once #ifndef STUDIO_H_ #define STUDIO_H_ typedef struct { int id; //ӳID char name[30]; //ӳ int rowsCount; //λ int colsCount; //λ int seatsCount; } studio_t; //˫ typedef struct studio_node { studio_t data; //ʵ struct studio_node *next; //ָ struct studio_node *prev; //ǰָ } studio_node_t, *studio_l...
C
/** * @file app.h * @brief 声明应用层的几个函数 * @author Shaobo Wang * @date 2018-5-21 * @version A001 * @par Copyright (c): Shaobo Wang */ #ifndef APP_H #define APP_H /** * 第一个应用层操作函数,接收8001,8002端口数据,计算结果发送给8003 * @param[in] argc 创建线程时传入的参数 */ void* app_read_pthread_func_f(void* argc); /**...
C
#include <stdio.h> #include <stdlib.h> //#define MAXNUM 100 typedef char DataType; struct SeqList { int MAXNUM; int n; DataType * element; }; typedef struct SeqList *PSeqList; PSeqList createNullList_seq(int m){ PSeqList palist = (PSeqList)malloc(sizeof(struct SeqList)); if(palist != NULL){ ...
C
#include <stdio.h> #include "graphlist.h" int addEdgeTest(); int removeEdgeTest(); int addVertexTest(); int removeVertexTest(); int main(int argc, char *argv[]) { if (argc != 3) { printf("Wrong arguments count"); return -1; } char *inputFile = argv[1]; char *outputFile = argv[2]; ...
C
#define BOOL_OBJC #include <stdio.h> #include <bool.h> int main(int argc, char* argv[]) { // Declare and initialise boolean variables BOOL b1 = YES; BOOL b2 = NO; // Print the boolean variables as strings to standard output printf("Bool values: %s, %s\n", BLSTR(b1), BLSTR(b2)); // Print integer representation...
C
#include "sort.h" /** * bubble_sort - sorts an array of integers in ascending order using the * Bubble sort algorithm * * @array: Pointer to the beginning of an array * @size: The size of the array * * Return: Nothing */ void bubble_sort(int *array, size_t size) { int flag = 1, tmp = 0; size_t i; if (size...
C
#include <stdio.h> #include <stdlib.h> void multiplicacaoMatrizFloat( float *m, float *n, float *p, int tamanho ) { int i; int j; int k; for ( i = 0; i < tamanho; ++i ) for ( j = 0; j < tamanho; ++j ) { float soma = 0; for ( k = 0; k < tamanho; ++k ) { float a = m[ i * tamanho + k ]; float b ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> void actualizarRecuperados(int id, int recuperados); void invertirCadena(char cadena[]); void ordenarCaracteres(char cadena[]); int main() { char cadena1[50]="Hola"; char cadena2[50]="algoritmo"; printf("%s\n", cadena1); invertirC...
C
/* * mi.c * * Created by on 2/6/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ /* #include <stdio.h> #include <stdlib.h> #include <math.h> #include "functionsMCMC.h" */ /* VARIABLES: v1 and v2 are the vector for which the MI has to be calculated. These vector...
C
#define F_CPU 8000000UL #include <inttypes.h> #include <avr/io.h> #include <util/delay.h> #include <avr/interrupt.h> #ifndef _UV #define _UV(x) (1 << (x)) #endif #define _setbit(x, y) ((x) |= _UV(y)) #define _clrbit(x, y) ((x) &= ~_UV(y)) #define DRVPORT PORTB #define DRVEN 0 #define XACT 0 #define YACT 1 #define...
C
/* Bellman - Ford Algorithm for finding shortest path */ #include<stdio.h> #include<stdbool.h> #include<stdlib.h> struct node { int u,v,w; }B[1000]; int dist[1000]; void init(int N) { int i; for( i=0 ; i <= N ; i++) dist[i]=100000; } int main() { int i,j,N,E; printf("Ent...
C
#include<stdio.h> #include<string.h> #define V 4 #define INF 99999 void printM(int A[][V]){ for(int i=0;i<V;i++){ for(int j=0;j<V;j++){ if(A[i][j]==INF) printf("%4s","INF"); else printf("%4d",A[i][j]); } printf("\n"); }} void floydW(int graph[][V]){ int A[V]...
C
// lab3.c // Conor Wolfin // 10.26.2018 // HARDWARE SETUP: // PORTA is connected to the segments of the LED display. and to the pushbuttons. // PORTA.0 corresponds to segment a, PORTA.1 corresponds to segement b, etc. // PORTB bits 4-6 go to a,b,c inputs of the 74HC138. // PORTB bit 7 goes to the PWM transistor ...
C
#include <stdio.h> #include "ft_putstr_non_printable.c" int main() { ft_putstr_non_printable("Hello\vWorld"); return (0); }
C
/** * Author: TripleZ * Date: 6/17/2018 * * Simplest implemention for "system" function. * **/ #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <wait.h> int mysys(char* command) { pid_t pid; pid = fork(); if (pid == 0) { execl("/bin/sh", "sh", "-c", command, NULL); ...
C
// Exercise Nr: 4 // Name : Syed Sagheer Hussain #include <msp430.h> #include "templateEMP.h" void turn_on(unsigned short); unsigned short value(unsigned int); int main () { initMSP(); P1SEL &= ~BIT5; P1SEL2 &= ~BIT5; P2SEL &= ~(BIT0 + BIT1 + BIT4 + BIT5 + BIT6); P2SEL2 &= ~(BIT0 + BIT1 + BIT4 + ...
C
/* ** my_tablen.c for my_tablen in /home/svirch_n//current_project/wolf3D/wolf3d-2017-svirch_n ** ** Made by nicolas svirchevsky ** Login <svirch_n@pc-svirch_n> ** ** Started on Tue Jan 8 11:44:17 2013 nicolas svirchevsky ** Last update Tue Jan 8 11:44:36 2013 nicolas svirchevsky */ int my_tablen(char **tab) { ...
C
#ifndef INCLUDE_CORE_BOOTROM_H #define INCLUDE_CORE_BOOTROM_H #include "debug.h" #include "types.h" #include "memfn.h" #define BOOTROM_SIZE 256 struct bootrom { union conversion con; u8 byte[BOOTROM_SIZE]; }; extern struct bootrom* new_bootrom(const char* path); extern void free_bootrom(struct bootrom* this); st...
C
#include "list.h" #include <stdio.h> #include <stdlib.h> void initList(List *list){ list->head = NULL; list->tail = NULL; } int sizeList(List *list){ Node *node = list->head; int size = 0; if(node == NULL){ return size = 0; } while(node != NULL){ size++; node = node->next; } return size; } void isEmp...
C
#include "holberton.h" /** * wildcmp - compares two strings to check whether identical * @s1: first string * @s2: second string * * Return: 1 if considered identical, 0 otherwise */ int wildcmp(char *s1, char *s2) { if (s1 && s2) return (1); else return (0); }
C
#include <stdio.h> #include "dw_time.h" int main(void) { Dw_time_type tm; dw_get_local_time(&tm); printf("dw time:%d-%d-%d %d:%d:%d\n",tm.year, tm.mon, tm.day, tm.hour, tm.min, tm.sec); return 0; }
C
#include<stdio.h> #include<stdlib.h> #define N 8 // chessboard size /* *八皇后问题 *http://ac.jobdu.com/problem.php?pid=1140 */ int abs(int a);//math abstract number; int x[N];//the position of the queen; int place(int i,int j);//return if you can put the queen here; void traceback(int index);//put the queen to the ind...
C
#include <stdio.h> #include <signal.h> #include <unistd.h> void handler(int signum) { if (signum == SIGINT){ printf("CONTROL SIGNAL IS PRESSED!\n"); } } int main(){ void (*handlr)(int); struct sigaction sa; handlr = handler; sa.sa_handler = *handlr; while(1){ printf("/"); ...
C
#include <stdio.h> #define ARRAY_LENGHT 20 typedef enum { success, incorrect_input } status_code; status_code input(int a[ARRAY_LENGHT], int *n, int *k) { if (scanf("%d", n) != 1 || *n > ARRAY_LENGHT || *n < 2) return incorrect_input; for (int i = 0; i < *n; i++) if (scanf("%d", &a[i]) != 1) return incorrect...
C
#include <stdio.h> #include <stdlib.h> #pragma warning(disable:4996) #define MAX_NODE 100 typedef struct _node //for adjacency list { int vertex; //꼭지점 //가중치 X struct _node* next; //다음 노드를 가리키는 포인터 }node; typedef struct _head // For indegree { int count; struct _node* next; }head; head network[MAX...
C
/* Description How far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We're assuming that the cards must be perpendicular to the table.) With two cards you can make the top card overhang the bottom one by half a card length, and the botto...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* calc_coor.c :+: :+: :+: ...
C
#include<stdio.h> int Find(int *arr, int ROW, int COL, int data) { int row = 0;//Ϊ0 int col = COL - 1;//Ϊ3 if ((arr != NULL) && (ROW>0&&COL>0))//жǷΪ { while (row<ROW&&col >= 0)//ֱų { if (arr[row*col + col] == data)//ϽΪҵ { return 1; } else if (arr[col*row + col]>data)//ϽǴdataҪ޳һ { --col; ...
C
#include "pqueue.h" struct pqueue* pqueue_init(struct pqueue* queue,comparator_func* func) { queue->list = NULL; queue->cmp = func; return queue; } void pqueue_add(struct pqueue* queue,void* elem) { struct node* new_node = malloc(sizeof(struct node)); new_node->elem = elem; new_node->next = NULL; new_node->pr...
C
#include <wiringPi.h> void configure_pin(int port); //Used [WiringPi docs](http://wiringpi.com/wp-content/uploads/2013/03/pins.pdf) int pins[21]; bool isSetup = false; int setup() { int setupValue = wiringPiSetup(); int i = 0; for(i; i < 21; ++i) { pins[i] = 0; } setup = true; return setupValue;...
C
/* ** socket_io.c for myirc in /home/pumpkin/Desktop/PSU_2015_myirc/src ** ** Made by Loik Gaonach ** Login <gaonac_l@epitech.net> ** ** Started on Fri May 27 19:00:11 2016 Loik Gaonach ** Last update Sun Jun 26 22:05:35 2016 julien */ #include <stdio.h> #include <string.h> #include <unistd.h> #include <sys/ioctl.h...
C
#include<stdio.h> int main() { int num; scanf("%d",&num); long long j=1,sum=0; int i,n; for(i=1;i<=num;i++) { j=j*i; sum=sum+j; } printf("%lld",sum); return 0; }
C
#include<stdio.h> int main() { int x=10,y=3; { int x=100,z=10; printf("%d %d",x,z); } printf("%d%d",x,z); } output: 'z' undeclare(first use in this function)