language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include<stdio.h>
#define N 10
void aleatorio(int *vector);
int main()
{
int *vector;
aleatorio(vector);
system("pause");
return 0;
}
void aleatorio(int *vector){
int i;
srand(time(NULL));
for (i=0;i<N;i++){
*(vector+i) = rand() % 3;
printf("%i, ",*(vector+i));
}
}
|
C | /* Write a program to find the simple interest for given principal amount P, time Tm(in years) and rate R.
Input:
The first line of input contains an integer, the number of test cases T. Each test case should contains three lines input . First line contains P then Tm and R in the last line.
Output:
For each tes... |
C | #include<stdio.h>
typedef struct dicnode{
int codeword; //used further in dictionary when you start adding newer strings to dictionary. Will point to index of prefixcode
unsigned int prefixcode; //Will add prefixstring
unsigned char suffixchar;// The appended char to string
}dicnode;
int lzw(char * ipfile, char * ... |
C | /*
* Copyright 2007 The Android Open Source Project
*
* Input event device.
*/
#include "Common.h"
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/input.h>
/*
* Input event device state.
*/
typedef struct EventState {
struct input_id ident;
char* na... |
C | /******************************
* Tristan Larkin
* Project 2
* Converting an binary string into ascii
****************************/
#include <stdio.h>
#include <string.h>
int currentWorkingChar; /* keeps track of important information */
int lines = 1;
int lineChar = 0;
int totalChar = 0;
int words = 1;
int power... |
C |
/************************************************************
* @file arch_arm32.c
* @description This is the function defination for the
* function declaraion in arch_arm32.h file
* @author Yue Wei
* @date Feb 10 2018
*************************************************************/
#include "arch_arm32.h"
__... |
C | /****************
* Helloworld.c
*****************/
#include <stdio.h>
#include <unistd.h>
int main(void)
{
printf("hello world! \n\n");
return 0;
}
|
C |
# include<stdio.h>
int main()
{
int i,length,mid, elementToBeSearched, start,end, arr[25];
printf("\nEnter Length Of Arr : ");
scanf("%d",&length);
printf("\nEnter elements in sorted order :- \n");
for(i=0;i<length;i++)
{
scanf("%d",&arr[i]);
}
start =0;
end = length -1;
mid = ( sta... |
C | #include <stdio.h>
#include <fcntl.h>
#include <stdint.h>
void LedInit( void );
void LedDestroy( void );
void LedWrite( uint8_t );
void ButtonInit( void );
void ButtonDestroy( void );
void ButtonWrite( uint8_t );
static int led_fd;
static int button_fd;
int main() {
LedInit();
ButtonInit();
char c;
while( rea... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
sort(long long A[], int n)
{
int i, j, k, sp, ac;
long long Temp;
for (i=n-1; i>0; i--)
{
sp=1;
for (j =0; j <i; j++)
if (A[j] > A[j+1])
{
Temp = A[j];
... |
C | /*
** EPITECH PROJECT, 2020
** NWP_myteams_2019
** File description:
** exception.h
*/
#ifndef NWP_MYTEAMS_2019_EXCEPTION_H
#define NWP_MYTEAMS_2019_EXCEPTION_H
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
enum error_type {
NO_ERROR = 0,
BAD_ALLOC,
BAD_CAST,
BAD_TYPEID,
BAD_EXCEPT... |
C | #include <stdio.h>
#include <stdlib.h>
#include "gd.h"
#include "gdtest.h"
int main()
{
gdImagePtr dst_tc, src;
int c1;
src = gdImageCreate(5,5);
gdImageAlphaBlending(src, 0);
gdImageColorAllocate(src, 255,255,255); /* allocate white for background color */
c1 = gdImageColorAllocateAlpha(src, 255,0,0,70);
g... |
C | #include<stdio.h>
main()
{
float cel=0,far=0;
printf("Enter temperature in Celsius\n");
scanf("%f",&cel);
far=((cel*9)/5)+32;
printf("Temperature is %f degree",far);
}
|
C | #include<stdio.h>
#include<time.h>
int fibo(int n);
int main(void)
{
time_t start, end;
int n, i;
float exetime;
FILE* fp;
//fp=fopen("input.txt","r");
start=clock();
scanf("%d", &n);
for(i=1;i<=n;i++) printf("fibo(%d) = %d\n", i, fibo(i));
close(fp);
end=cl... |
C | //pointerex3
#include <stdio.h>
int main(){
int a = 100, b = 200, temp;
int *p1, *p2, *p_temp; //
p1 = &a; //p1 a
p2 = &b; //p2 b
printf("a : %d\t b : %d\n",a,b);
printf("/////////////////////////////////////////");
printf("\n>> a b ٲٱ \n");
temp = a;
a = b;
b = temp;
printf("a : %d\t b : %d\n",a,b)... |
C | /* Somewhere in thread function */
/* Get device hostname in blocking mode */
/* Function returns actual result */
if (lwgsm_sms_send("+0123456789", "text", NULL, NULL, 1 /* 1 means blocking call */) == lwgsmOK) {
/* At this point we have valid result from device */
printf("SMS sent successfully\r\n");
} else ... |
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 | /* image - loads, saves, and swizzles images */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <png.h>
#ifdef _PSP
#include<pspgu.h>
#else
#define GU_PSM_5650 (0)
#define GU_PSM_8888 (3)
#define GU_PSM_T4 (4)
#define GU_PSM_T8 (5)
#endif
#include "main.h"
//#define Color unsigned long
#define M... |
C | /*
* digitalportsDriver.c
*
* Created on: Nov 26, 2015
* Author: LUIS ALFONSO
*/
#include "digitalportsDriver.h"
#include "mytypes.h"
#include "derivative.h"
U08 digitalPorts_vdfnSetPortOutput(PORT_MemMapPtr port, U08 num){
if (port == PORTA_BASE_PTR){
SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK; /* Port A Clock... |
C | /* ****************************************************************************
* FILE: LinkedListTest.c
* CREATED: Friday, 6th September 2019 11:40:35 am
* AUTHOR: Jonathon Winter
*
* PURPOSE: Test harness for linked_list.c (generic).
*
* LAST MOD: Friday, 11th October 2019 17:07:00 pm
... |
C | /*
GOPI KRISHNA TUMMALA and RUPAM KUNDU
The Ohio State Univerisity
Network Programming: Final Project submission
FILE: ftps Program (Server Application)
*/
#include <netdb.h>
#include <strings.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/... |
C | #ifndef SET_H_
#define SET_H_
typedef void * Type;
typedef struct strSet * Set;
typedef enum {FALSE, TRUE} bool;
typedef int (*CompareFunc) (Type, Type);
typedef void (*PrintFunc) (Type);
typedef void (*DestroyFunc) (Type);
Set set_create(CompareFunc cf, PrintFunc pf, DestroyFunc df);
int set_size(Set);
bool set_add(... |
C | /* Aufgabe1 ****************************************************************
**
** Author: Michael Wolz
** Matrikelnummer: 1195270
**
** Author: Aaron Winziers
** Matrikelnummer: 1176638
**
******************************************************************************/
#include <stdio.h>
#include <string.h> //für strl... |
C | #include "lesson2.7.3.c"
static int64_t sum( int64_t x, int64_t y) { return x + y; }
typedef int64_t folding(int64_t, int64_t);
/* Свернуть список l с помощью функции f. */
int64_t list_fold(
const struct list* l,
int64_t init,
folding f) {
int64_t result = init;
while (l != NULL) {
... |
C | #include"buildTree.h"
#include"treeStructure.h"
#include"nodeValue.h"
#include"writeTree.h"
#include"stdio.h"
#include"stdlib.h"
#include"math.h"
// make a node at given location (x,y) and level
Node *makeNode( double x, double y, int level ) {
int i;
Node *node = (Node *)malloc(sizeof(Node));
... |
C | /**
* @file CatClientes.h
* @author Grupo4
* @date Abril 2020
* @brief Ficheiro que contém declaração de funções e macros que primitem manipular o Catalogo de Clientes.
*
*/
#ifndef CatClientes_H
#define CatClientes_H
#include <stdlib.h>
#include <glib.h>
#include "Cliente.h"
/**
* @brief Tamanho do abeceda... |
C |
#include <stdio.h>
#include <string.h>
#include <sys/unistd.h>
#include <sys/stat.h>
#include <sys/dirent.h>
#include "esp_err.h"
#include "esp_log.h"
#include "esp_vfs_fat.h"
#include "freertos/task.h"
#include "driver/sdmmc_host.h"
#include "driver/sdspi_host.h"
#include "sdmmc_cmd.h"
static const cha... |
C | #include "qgpg_proto_def.h"
#include "sock_utils.h"
time_t global_time;
int construct_server_message(int socketfd, int type){
printf("SENDING %d\n", type);
struct qgpg_message server_message;
struct qgpg_data null_data;
// data is empty
bzero(&null_data, sizeof(struct qgpg_data));
global_time = time(NULL... |
C | #include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
int sum = 0;
int i = 0;
int number = 0;
int next_number = 0;
char *input = argv[1];
int input_len = strlen(input);
for (i = 0; i < input_len; i++) {
number = input[i] - '0';
if (i == input_len - 1)... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include "usbboot.h"
void help(char *prg)
{
printf("Usage: %s command1 command2...\n"
"\nBasic commands:\n"
"cpu | Query CPU ID\n"
"flush | Flush I-Cache and D-Cach... |
C | void main()
{
int a[25],d[25];
int max;
int i,j,k;
scanf("%d",&k);
for(i=0;i<k;i++)
{
scanf("%d",a+i);
}
d[k-1]=1;
for(i=k-2;i>=0;i--)
{
max=0;
for(j=i+1;j<k;j++)
{
if(a[i]>=a[j]&&max<d[j])
{
max=d[j];
}
}
if(max==0)
{
d[i]=1;
}
... |
C | #include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <time.h>
#include <sys/time.h>
#include <stdlib.h>
#define NUM_THREADS 10
/**
* Can use the following struct for
* the nanosleep function.
* the first value is sleep time in seconds
* the second vaue is sleep time in nanoseconds.... |
C | #include <stdio.h>
int main(void)
{
int a[] = {1,2,3,4};
printf("sizelen = %d\n", sizeof(a) / sizeof(a[0]));
return 0;
}
|
C | // 문자열 저장을 위한 trie 자료구조 헤더
struct Trie_node{
bool fin;
char val;
Trie_node* next[26];
~Trie_node(){
for(int i=0; i<26; i++) delete next[i];
}
void insert(char *key){
if(key == '\0') fin = true;
else{
int cur = *key - 'A';
if(next[cur] == NUL... |
C | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main(void){
int n;
scanf("%d",&n);
int i,a[n],c = 0,cc = 1;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
int now = a[0];
for(i=1;i<n;i++){
if(a[i] == now){
cc++;
}els... |
C | #include<stdio.h>
#define N 5
int main() {
// Declarar arreglo de 5 elementos
int v[N];
// Declarar variables
int i, * p;
// Asignar elementos al arreglo
for (i = 0; i < N; i++) {
v[i] = i;
}
// Imprimir el arreglo usando la notación convencional
for (i = 0; i < N; i++) {
printf("%d\n", v... |
C | /*########################################################
##File Name: message_rcv.c
##Created Time:2015年12月15日 星期二 19时31分38秒
##Author: Norman
##Description:
##
##Issue:
##
##Analyze: 1.内核维护着消息队列
## 2.当内核消息队列中消息数为0时,再接收消息发生阻塞,当队列中有消息立即可接收到
## 3.内核消息队列为链表实现,在每创建一个节点需要malloc所以很消耗
##
##Induction:
##
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* unsetenv.c :+: :+: :+: ... |
C | #include<stdio.h>
int main(){
int n,x;
int min=65535;
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d",&x);
if(x<min)
min=x;
}
printf("min = %d",min);
}
|
C | /*
* Author: Lorenzo Tabasso, mat: 812499
* Author: Andrea Malgaroli, mat: 823429
*/
#include "sorts.h"
// Prototype of merge function, used in merge_sort algorithm.
// It takes as input an array of void pointers, the left index of the array,
// the center index of the array, the right index of the array,
// and a... |
C | #include "../include/Dict.h"
void Dict_init(Dict_t* dic, int size)
{
dic->paths = malloc(size * sizeof(int));
ASSERT(dic->paths, , size);
dic->preds = malloc(size * sizeof(short));
ASSERT(dic->preds, , size);
for (int i = 0 ; i < size ; i++) {
dic->paths[i] = INF;
}
dic->siz... |
C | #include<stdio.h>
char cadena[50];
char sub[50];
int i=0;
int a=0;
int main()
{
printf("dame la palabra\n");
scanf("%s",cadena);
scanf("%s",sub);
while(cadena[i]!='\0'){
while(cadena[i]==sub[a]){
i++;
a++;
if(sub[a]==0){
printf("\n\nexiste\n\n");
}
}
i++;
a=0;
if(0== cade... |
C | /** @file
EFI_FILE_PROTOCOL implementation for EXT4
Copyright (c) 2021 Pedro Falcato All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include "Ext4Dxe.h"
#include <Library/BaseUcs2Utf8Lib.h>
/**
Reads a symlink file.
@param[in] Partition Pointer to the ext4 part... |
C | #include <stdio.h>
/*void delete(int *arr,int size)
{
int i;
int *ptr=arr;
int arr2[size];
int *ptr2=arr2;
for(i=0;i<size;i++)
{
if(i%2!=0)
{
*ptr2=*ptr;
printf("%d ",*ptr2);
ptr2++;
}
ptr++;
}
}
void input()
{
int size;
int arr[size];
prin... |
C | // Erich Viebrock
#include <stdlib.h>
#include <stdio.h>
int rand1 = 21;
int rand2 = 20;
int main(void)
{
printf("Welcome to Wythoff's Game!\n");
printf("Author: Erich Viebrock\n\n");
printf("Enter two positive numbers to initialize the random number generator.\n");
printf("Number 1: ");
scanf("%d", &rand1);
... |
C | #include <stdio.h>
#include <signal.h>
void signal_hand(int signo) {}
int main() {
int child;
char c1 = '1';
char c2 = '2';
sigset_t smask, wmask;
sigemptyset(&wmask);
sigemptyset(&smask);
sigaddset(&smask, SIGUSR1);
sigprocmask(SIG_BLOCK, &smask, NULL);
signal(SIGUSR1, signal_hand);
child = fork();
... |
C | /* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
* File Name : loopSumOfNatural.c
* Purpose : To find the sum of all natural numbers between 1 to n using while loop
Input :upper limit: 10
Output: Sum of natural numbers 1-10: 55
* Creation Date : 09-12-2019
* Last Modified :
* Created By : Jarrod Hatting
_._._._._._._._... |
C | /* FILE file_util.c
* Implementation of the file_util functions.
* Author: Francois Pitt, March 2012.
*/
/******************************************************************************
* Types and Constants. *
***********************************************... |
C | // DCT Compression //
/* compression lib */
#include <stdlib.h>
#include "compression.h"
#include "quality.h"
#include "itables.h"
#include "dtables.h"
// Zig-zag order of (X,Y) discrete cosine transforms.
const int SIG[64] = {0, 1, 8, 2, 9, 16, 3, 10, 17, 24, 4, 11, 18, 25, 32, 5, 12, 19, 26, 33,... |
C |
#ifndef _OS_STR_H
#define _OS_STR_H
#include <sis_os.h>
#define snprintf _snprintf
//#define vsnprintf(a,b,c,d) vsnprintf_s(a,b,c,NULL,d)
#define vsnprintf _vsnprintf
#define sis_atoll atoll
char *sis_strcat(char *out_, size_t *olen_, const char *in_);
inline char *sis_strsep(char **string_, const char *sub)
{
... |
C | // Подгружаемые модули:
//SUB_NN_N - вычитание из первого большего числа, второе меньшее или равное
//MUL_ND_N - умножение на цифру
//COM_NN_D - сравнение двух чисел
// Прототип struct NATURAL SUB_NDN_N(struct NATURAL A, struct NATURAL B, struct NATURAL c), где
// 1-й параметр - уменьшаемое
// 2-й параметр - вычи... |
C | /*
** EPITECH PROJECT, 2021
** B-PSU-200-PAR-2-1-mysokoban-jules.gresset
** File description:
** level_selector
*/
#include "sokoban.h"
void level_loader(int highlight, char **choices, map *map, pos *pos)
{
if (choices[highlight] == choices[0]) {
map->level = 1;
levelchecker(map, pos);
}
i... |
C | #include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include "net.h"
struct net_info net_var = {0};
int net_init(char *ip, char *port)
{
net_var.clnt_addr_size = sizeof(struct sockaddr_in);
net_var.serv_sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
net_var.serv_addr.sin_family = AF_INET;
net_va... |
C | /*Michael Glazier
File Packing Program
*/
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
int checkValid(int argc, char* argv[]);
int max(int a, int b);
void writeError(int err);
int min(int a, int b);
i... |
C | /*
Лабороторная работа 14
Студента группы: ...
Ф.И.О.
*/
#include <stdio.h>
void swap(int *a, int *b);
int main(void)
{
const int N = 7;
int n, a[N][N], i, j, k;
// k - счетчик для цикла по диагоналям
while (1)
{
printf("Введите n (1 - %d. Завершить - 0): ", N);
scanf("%d", &n);
if (n == 0) break;
... |
C | #include <stdio.h>
#include <ctype.h>
#include <unistd.h>
#include <strings.h>
#include <string.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
int main(int argc, char** argv[]){
if (argc < 3) {
perror("Not enough arguments. Exiting.... |
C |
#include <string.h>
#include <jni.h>
//C 实现的 加法
int addFun(int x, int y);
//C 实现的 减法
int subFun(int x, int y);
//用函数指针实现--加减
int compute(int (*p)(int, int), int a, int b);
//返回最小数的地址
int *getMinPointer(int numbers[], int len); |
C | /**
* @file aux.c
* @author <a href="mailto:niccolo.marastoni@studenti.univr.it">Niccolò Marastoni</a>
* @author <a href="mailto:andrei.munteanu@studenti.univr.it">Andrei Munteanu</a>
* @date July, 2013
* @brief Provides functions
*
*/
#include "header.h"
void syserr(const char *str){
write(3,str,strlen... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ncurses.h>
void pickup(char item) {
int y;
int x;
getyx(stdscr, y, x);
move(1,5);
clrtoeol();
if (item == ')') {
mvprintw(1, 5, "Hero picked up a common weapon!");
}
else if (item == '(') {
mvprintw(1... |
C | //
// Created by seanr on 2016/2/5.
//
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
// Definition for a binary tree node.
struct TreeNode {
int val;
struct TreeNode* left;
struct TreeNode* right;
};
struct ListNode {
int val;
struct ListNode* next;
};
// submit the codes below
stru... |
C | /*
module : stack.c
version : 1.12
date : 03/28/20
*/
#ifndef STACK_C
#define STACK_C
/**
stack : .. X Y Z -> .. X Y Z [Z Y X ..]
Pushes the stack as a list.
*/
PRIVATE void do_stack(void)
{
Node *cur, *node = 0;
#ifndef OLD_RUNTIME
COMPILE;
#endif
for (cur = stk; cur; cur = cur->next)... |
C | /* Distance of a Marathon to kilometers */
#include <stdio.h>
int main(void)
{
int miles = 26, yards = 385;
double kilometers;
kilometers = 1.609 * (miles + yards / 1760.0);
printf("\nA marathon is %lf kilometers\n", kilometers);
return 0;
}clear
|
C | //ڿ (p136_pointer4)
#include <stdio.h>
main()
{
int i, j;
char sa[5][10]={"use", "mouse", "printer",
"computer", "processor"};
char *sp[5]={"use", "mouse", "printer",
"computer", "processor"};
printf("=== Ϲ 迭 ===\n");
for(i=0;i<5;i++)
printf("sa[%d] : %d, %s\n", i,sa[i],sa[i]);
printf("\n=== 迭... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "client.h"
#include "clientcontext_linked_list.h"
#include "clientcontext_hashtable.h"
ClientContext_Hashtable* ClientContext_Hashtable_Create(unsigned int init_size) {
ClientContext_Hashtable* clientcontext_hashtable = (ClientContext_Hashtable*)mall... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: ... |
C | //writter: wang zhishang
//assignment 4
#include <stdio.h>
#include <dirent.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <stdbool.h>
#include "hashmap.h"
#define MAXLINE 1024
int numfiles = 0;
int numthreads;
int filesProcessed;
char **filenames; //array of file names
char * directory;
ha... |
C | #include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <netdb.h>
#include <poll.h>
#include <sys/errno.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <time.h>
#include... |
C | // Adding two 2-D Matrices
#include <stdio.h>
int main()
{ int m,n;
printf("Enter the no. of rows and columns for both Matrices: \n");
scanf("%d %d",&m,&n);
int a[m][n], b[m][n], result[m][n];
// Taking input for 1st Matrix
printf("Enter elements of 1st matrix\n");
for (int i = 0;... |
C | #include "variadic_functions.h"
/**
* print_all - prints all formats passed
* @format: the formats addmited by my function
* Return: Nothing.
*/
void print_all(const char * const format, ...)
{
va_list valist;
int i = 0, flag = 0;
char *s;
va_start(valist, format);
while (format && format[i])
{
switch (f... |
C | #include<stdio.h>
#include<sys/stat.h>
#include<sys/types.h>
#include<fcntl.h>
#include<unistd.h>
int main(void) {
int fd, retval;
char buffer[] = "TESTDATA";
fd = open("/tmp/myfifo",O_RDONLY);
retval = read(fd, buffer, sizeof(buffer));
fflush(stdin);
write(1, buffer, sizeof(buffer));
printf("\n");
close(fd... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int i;
FILE * fp;
fp = fopen("data1.txt","w");
printf("Random Integer Number: ");
scanf("%d",&i);
srand(time(0));
for(int n = 0; n<i; n++ )
{
fprintf(fp, "%d \n", rand() %1000);
}
fclose(fp)... |
C | #include <stdio.h>
#include <fcntl.h>
main() /* copy input to output */
{
char *s;
read(0,s,8);
write(1,s,8);
write(1,"test",8);
}
char mygetc(){
char s[1];
read(0,s,1);
return s[0];
}
|
C | #include<stdio.h>
int mystrspn(const char *buf,const char *buf1);
int main()
{
char buf[100],buf1[100];
int i,d;
printf("ENTER THE 1st STRING\n");
fgets(buf,100,stdin);
for(i=0;buf[i]!='\n';i++);
buf[i]='\0';
printf("ENTER THE 2nd STRING\n");
fgets(buf1,100,stdin);
for(i=0;buf1[i]!='\n';i++);
buf1... |
C | #include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node *next;
}*start=NULL;
struct node *insert(struct node *start,int data)
{
struct node *newnode,*curr;
newnode=(struct node *)malloc(sizeof(struct node));
newnode->data=data;
newnode->next=NULL;
if(start==NULL)
{
st... |
C | #include "../SDCARD/spi.h"
void SPI_init(SPI_TypeDef* SPIx, unsigned int prescaler)
{
/* configure pins used by SPI1
* PA5 = SCK
* PA6 = MISO
* PA7 = MOSI
*/
// connect SPI1 pins to SPI alternate function
RCC->AHB1ENR|=RCC_AHB1ENR_GPIOAEN;
GPIOA->AFR[0]|=0x55500000;
GPIOA->MODER|=GPIO_MODER_MODER5_1;
GPIOA->M... |
C | //para obter o ltimo digito de um nmero, basta executar a operao
//resto por 10. Ler um nmero inteiro qualquer e exibir seu ltimo
//dgito
#include <stdio.h>
int main()
{
int numero, ultimo_digito;
printf("Digite um numero: ");
scanf("%d", &numero);
ultimo_digito = numero % 10;
printf("%d", ultimo_d... |
C | #include <stdio.h>
#include <stdlib.h>
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
typedef struct node Node;
struct node {
int value;
Node* father, *left, *right;
};
typedef struct {
Node* root;
int total;
}Tree;
void initializeTree (Tree* _tree) {
_tree->total = 0;
_tree->root = NULL;
}
int height(Node* _... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* pipex.c :+: :+: :+: ... |
C | //
// Created by Alex on 21/05/2019.
//
#include "listaJuego.h"
ListaJuego LISTAJUEGO_crea() {
ListaJuego l;
Nodo_jugador *fantasmaStart;
Nodo_jugador *fantasmaEnd;
fantasmaStart = (Nodo_jugador*)malloc(sizeof(Nodo_jugador));
fantasmaEnd = (Nodo_jugador*)malloc(sizeof(Nodo_jugador));
if (fan... |
C | #include<stdio.h>
#include<stdlib.h>
typedef long long int lli;
lli cmpfunc(const void *a,const void *b){
return(*(lli*)a - *(lli*)b);
}
int main() {
int testcases;
scanf("%d", &testcases);
while(testcases--){
lli n,k;
scanf("%lld %lld", &n,&k);
lli arr[n];
int flag =1;
for(int i=0;i<n... |
C | /*
-------------------------------------
File: build_trees.c
Project: huffmancode
A program that takes a list of counted char nodes and uses them to build a huffman tree.
-------------------------------------
Author: Tyler Dezeeuw
ID: 201533010
Email: deze3010@mylaurier.ca
Version 2020-11-... |
C | #ifndef HASHMAP_H
#define HASHMAP_H
//includes from standart libs:
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
// Error cases
#define HASHMAP_SUCCESS 0 //No error
#define HASHMAP_OVERLOAD 1 //Hashmap is full
#define HASHMA... |
C | #ifndef LINKED_LIST_H
#define LINKED_LIST_H
#include <stdio.h>
#include <stdlib.h>
#include "edge.h"
struct node{
int value;
struct node *next;
};
struct linked_list{
struct node *head;
size_t size;
};
struct edge_node{
struct edge value;
struct edge_node *next;
};
struct linked_edge_list{
... |
C | #include <stdio.h>
#include <string.h>
void toString(int var3){
/*3#__Print palindrom atau print Jumlah Vokal
Penjelasan:
Fungsi toString berguna untuk menentukan bagaimana output akan di print.
Jika argumen var sebesar 0 maka akan diprint output Palindrom. Dan jika selain 0
maka diprint vokal terse... |
C | /* robotServer.c
By REDACTED, REDACTED, REDACTED, REDACTED, Ryan Baxley */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <errno.h>
#define BUFFERCONSTANT 1000 ... |
C | #ifndef FIBRATIONF_H
#define FIBRATIONF_H
/*
The code here represents the central module for the implementation of the coarsest
refinement graph partitioning algorithm for input-tree stability, containing the
functions used in the main code. The necessary comments are given at the beginning of
each... |
C | #include<stdio.h>
int main()
{
int a,b,i,sum;
scanf("%d",&a);
for(i=0; i<10; i++)
{
sum=sum+a;
printf("%d * %d = %d\n",a,i,sum);
}
}
|
C | #include "morn_ptc.h"
void test2();
void test3();
void test1()
{
for(int i=0;;i++)
{
printf("running in test1,i=%d, goto test2...\n",i);
mCoroutine(test2);
printf("running in test1,i=%d, goto test3...\n",i);
mCoroutine(test3);
}
}
void test2()
{
for(int i=0;;i++)
{
... |
C | #include <stdio.h>
#include <stdlib.h>
int calculate_sum(int length);
int *pglobal;
#pragma omp threadprivate(pglobal)
int main()
{
int i, j, sum, TID, n = 5;
int length[n], check[n];
for (i=0; i<n; i++)
{
length[i] = 10 * (i+1); //i.e. 10 20 30 40 50
check[i] = length[i]*(length[i]+1)/2... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset_main.c :+: :+: :+: ... |
C | /*
<p>Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only <em>distinct</em> numbers from the original list.</p>
<p><strong>Example 1:</strong></p>
<pre>
<strong>Input:</strong> 1->2->3->3->4->4->5
<strong>Output:</strong> 1->2->5
</pre>
<p><strong>Example 2:... |
C | /*
* 28 june 2005
* This is to let us print alignments in a form for something
* like chimera.
* We will take a "pair_set" and filename.
*/
#if !defined (lint) && !defined (DONT_SEE_RCS)
static const char *rcsid =
"$Id: pair_set_chim.c,v 1.3 2007/02/12 17:03:56 tmargraf Exp $";
#endif /* !defined (lint) &&... |
C | #include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <termios.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <getopt.h>
#include <poll.h>
void setOrig(struct termios term);
void readWrite(int fdIn, int fdOut);
void sigHandler(int sigNum);
struct termios term;
int main(int... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_ASTERISCOS 50
#define MENSAJE "Bienvenido a mi agenda"
#define MAX_NOMBRE 50
#define MAX_APELLIDO 50
#define MAX_TEL 14
#define MAX_REGISTROS 10
struct Persona{
char nombre[MAX_NOMBRE];
char apellido[MAX_APELLIDO];
char genero;
char tel[MAX_TEL... |
C | #include <stdio.h>
#include <stdlib.h>
#include <conio.h>
int i;
typedef struct
{
char provedorUno;
char provedorDos;
char provedorTres;
}eProvedores;
typedef struct
{
char descripcion[31];
int importe;
int cantidad;
int cantidadMenorOIgualADiez;
int cantidadMayorADiez;
int isEmpt... |
C | #include <stdio.h>
int main() {
int n;
int a, b;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i == 0 || i == n - 1)//
printf("*");
else if (j == 0||j==n-1)//
printf("*");
else {//밢
if (j == i || j == n - i-1)
printf("*");
else
printf(" ");
... |
C | //
// vector.c
// C-ray
//
// Created by Valtteri Koskivuori on 28/02/2015.
// Copyright © 2015-2018 Valtteri Koskivuori. All rights reserved.
//
#include "includes.h"
#include "vector.h"
//Main vertex arrays
/*
Note:
C-Ray stores all vectors and polygons in shared arrays, and uses data structures
to keep tra... |
C | #include <stdio.h>
int main()
{
int i = 1, fact = 1; //ʱⰪ i = 1
for( ; i<= 10; i++) //ʱⰪ
{
fact = fact * i;
}
printf("1 10 : %d \n", fact);
system("pause");
return 0;
}
|
C | #include<stdio.h>
int main()
{
int age, time;
printf("ð ̸ ԷϽÿ : ");
scanf_s("%d%d", &time, &age);
if (time > 24)
printf("Ϸ 24ð");
else if (time > 17)
printf(" 10,000 Դϴ.");
else if ("age>=65||age<=12||age>=3")
printf(" 25,000 Դϴ.");
else
printf(" 34,000 Դϴ.");
return 0;
} |
C | # include <stdio.h>
void main(){
int n; // number of jobs
int i, j, temp, max_deadline = -1, profit = 0, previous_deadline = -1, random = -1;
// Inputs
printf("Enter number of jobs : ");
scanf("%d", &n);
int p[n], d[n], index[n]; // profit, deadline, index
printf("Enter profits and deadlines : \n");
for(i ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.